Fix 32910 part2 (#38709)

* cloud/packet: remove bogus mutual exclusions

operating_system is a required parameter, for custom ipxe it should be
set to custom_ipxe. The always_pxe and ipxe_script_url parameters are
only valid when operating_system==custom_ipxe, but they are not mutually
exclusive.

* cloud/packet: disallow custom_ipxe settings for supported oses.
pull/38709/merge
Manuel Mendez 7 years ago committed by ansibot
parent 3bfe32b9d9
commit b4f4cb9b87

@ -447,6 +447,11 @@ def create_single_device(module, packet_conn, hostname):
locked = module.params.get('locked')
ipxe_script_url = module.params.get('ipxe_script_url')
always_pxe = module.params.get('always_pxe')
if operating_system != 'custom_ipxe':
for param in ('ipxe_script_url', 'always_pxe'):
if module.params.get(param):
raise Exception('%s paramater is not valid for non custom_ipxe operating_system.' % param)
device = packet_conn.create_device(
project_id=project_id,
hostname=hostname,
@ -609,8 +614,6 @@ def main():
),
required_one_of=[('device_ids', 'hostnames',)],
mutually_exclusive=[
('always_pxe', 'operating_system'),
('ipxe_script_url', 'operating_system'),
('hostnames', 'device_ids'),
('count', 'device_ids'),
('count_offset', 'device_ids'),

Loading…
Cancel
Save