Revert openstack.cloud.server parameter user_data to userdata
openstacksdk's create_server() [1] takes cloud-init userdata as a plaintext string (or other data types [2]) via argument 'userdata', not 'user_data' [3]. This is 'userdata' argument of create_server() is different from the 'user_data' value which is returned [4]. The latter is base64 decoded, while the former is e.g. a plaintext string. As a (tiny) visual indicator for this difference, this patch reverts the module parameter 'user_data' to 'userdata' which was used before this module got refactored [5]. [1]57fbb72e32/openstack/cloud/_compute.py (L678)
[2]57fbb72e32/openstack/cloud/_compute.py (L1757)
[3]57fbb72e32/openstack/cloud/_compute.py (L796)
[4]57fbb72e32/openstack/compute/v2/server.py (L223)
[5]ac401bb354
Change-Id: I1f3b9314e4d82674cd2ae45f6209de5611e2b6cb
This commit is contained in:
parent
65ac75b518
commit
1e27b6b69c
@ -205,12 +205,11 @@ options:
|
|||||||
into active state.
|
into active state.
|
||||||
default: 180
|
default: 180
|
||||||
type: int
|
type: int
|
||||||
user_data:
|
userdata:
|
||||||
description:
|
description:
|
||||||
- Opaque blob of data which is made available to the instance.
|
- Opaque blob of data which is made available to the instance.
|
||||||
- This server attribute cannot be updated.
|
- This server attribute cannot be updated.
|
||||||
type: str
|
type: str
|
||||||
aliases: ['userdata']
|
|
||||||
volume_size:
|
volume_size:
|
||||||
description:
|
description:
|
||||||
- The size of the volume to create in GB if booting from volume based
|
- The size of the volume to create in GB if booting from volume based
|
||||||
@ -423,7 +422,7 @@ EXAMPLES = '''
|
|||||||
image: "Ubuntu Server 14.04"
|
image: "Ubuntu Server 14.04"
|
||||||
flavor: "P-1"
|
flavor: "P-1"
|
||||||
network: "Production"
|
network: "Production"
|
||||||
user_data: |
|
userdata: |
|
||||||
#cloud-config
|
#cloud-config
|
||||||
chpasswd:
|
chpasswd:
|
||||||
list: |
|
list: |
|
||||||
@ -444,7 +443,7 @@ EXAMPLES = '''
|
|||||||
image: "Ubuntu Server 22.04"
|
image: "Ubuntu Server 22.04"
|
||||||
flavor: "P-1"
|
flavor: "P-1"
|
||||||
network: "Production"
|
network: "Production"
|
||||||
user_data: |
|
userdata: |
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
apt update
|
apt update
|
||||||
apt -y full-upgrade
|
apt -y full-upgrade
|
||||||
@ -818,7 +817,7 @@ class ServerModule(OpenStackModule):
|
|||||||
security_groups=dict(default=[], type='list', elements='str'),
|
security_groups=dict(default=[], type='list', elements='str'),
|
||||||
state=dict(default='present', choices=['absent', 'present']),
|
state=dict(default='present', choices=['absent', 'present']),
|
||||||
terminate_volume=dict(default=False, type='bool'),
|
terminate_volume=dict(default=False, type='bool'),
|
||||||
user_data=dict(aliases=['userdata']),
|
userdata=dict(),
|
||||||
volume_size=dict(type='int'),
|
volume_size=dict(type='int'),
|
||||||
volumes=dict(default=[], type='list', elements='str'),
|
volumes=dict(default=[], type='list', elements='str'),
|
||||||
)
|
)
|
||||||
@ -1065,7 +1064,7 @@ class ServerModule(OpenStackModule):
|
|||||||
'boot_volume', 'config_drive', 'description', 'key_name',
|
'boot_volume', 'config_drive', 'description', 'key_name',
|
||||||
'name', 'network', 'reuse_ips', 'scheduler_hints',
|
'name', 'network', 'reuse_ips', 'scheduler_hints',
|
||||||
'security_groups', 'terminate_volume', 'timeout',
|
'security_groups', 'terminate_volume', 'timeout',
|
||||||
'user_data', 'volume_size', 'volumes', 'wait']:
|
'userdata', 'volume_size', 'volumes', 'wait']:
|
||||||
if self.params[k] is not None:
|
if self.params[k] is not None:
|
||||||
args[k] = self.params[k]
|
args[k] = self.params[k]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user