mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
cs_instance: fix py3 user_data base64 (#37135)
* cs_instance: tests: reproduce py3 user_data base64 issue * cs_instance: fix base64 encoding with py3
This commit is contained in:
parent
4b6b2d4206
commit
0130490faa
2 changed files with 23 additions and 4 deletions
|
@ -348,8 +348,13 @@ instance_name:
|
|||
|
||||
import base64
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.cloudstack import (AnsibleCloudStack, CS_HYPERVISORS, cs_argument_spec,
|
||||
cs_required_together)
|
||||
from ansible.module_utils._text import to_bytes, to_text
|
||||
from ansible.module_utils.cloudstack import (
|
||||
AnsibleCloudStack,
|
||||
CS_HYPERVISORS,
|
||||
cs_argument_spec,
|
||||
cs_required_together
|
||||
)
|
||||
|
||||
|
||||
class AnsibleCloudStackInstance(AnsibleCloudStack):
|
||||
|
@ -592,7 +597,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
|||
def get_user_data(self):
|
||||
user_data = self.module.params.get('user_data')
|
||||
if user_data is not None:
|
||||
user_data = base64.b64encode(str(user_data))
|
||||
user_data = to_text(base64.b64encode(to_bytes(user_data)))
|
||||
return user_data
|
||||
|
||||
def get_details(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue