mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
hpilo modules: PEP8 fixes (#27739)
This commit is contained in:
parent
d3e5d30f7c
commit
a34ef12d73
4 changed files with 27 additions and 29 deletions
|
@ -122,15 +122,15 @@ warnings.simplefilter('ignore')
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec=dict(
|
||||||
host = dict(required=True, type='str'),
|
host=dict(type='str', required=True),
|
||||||
login = dict(default='Administrator', type='str'),
|
login=dict(type='str', default='Administrator'),
|
||||||
password = dict(default='admin', type='str', no_log=True),
|
password=dict(type='str', default='admin', no_log=True),
|
||||||
media = dict(default=None, type='str', choices=['cdrom', 'floppy', 'rbsu', 'hdd', 'network', 'normal', 'usb']),
|
media=dict(type='str', choices=['cdrom', 'floppy', 'rbsu', 'hdd', 'network', 'normal', 'usb']),
|
||||||
image = dict(default=None, type='str'),
|
image=dict(type='str'),
|
||||||
state = dict(default='boot_once', type='str', choices=['boot_always', 'boot_once', 'connect', 'disconnect', 'no_boot', 'poweroff']),
|
state=dict(type='str', default='boot_once', choices=['boot_always', 'boot_once', 'connect', 'disconnect', 'no_boot', 'poweroff']),
|
||||||
force = dict(default=False, type='bool'),
|
force=dict(type='bool', default=False),
|
||||||
ssl_version = dict(default='TLSv1', choices=['SSLv3', 'SSLv23', 'TLSv1', 'TLSv1_1', 'TLSv1_2']),
|
ssl_version=dict(type='str', default='TLSv1', choices=['SSLv3', 'SSLv23', 'TLSv1', 'TLSv1_1', 'TLSv1_2']),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ def main():
|
||||||
image = module.params['image']
|
image = module.params['image']
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
force = module.params['force']
|
force = module.params['force']
|
||||||
ssl_version = getattr(hpilo.ssl, 'PROTOCOL_' + module.params.get('ssl_version').upper().replace('V','v'))
|
ssl_version = getattr(hpilo.ssl, 'PROTOCOL_' + module.params.get('ssl_version').upper().replace('V', 'v'))
|
||||||
|
|
||||||
ilo = hpilo.Ilo(host, login=login, password=password, ssl_version=ssl_version)
|
ilo = hpilo.Ilo(host, login=login, password=password, ssl_version=ssl_version)
|
||||||
changed = False
|
changed = False
|
||||||
|
@ -183,13 +183,13 @@ def main():
|
||||||
module.fail_json(msg='HP iLO (%s) reports that the server is already powered on !' % host)
|
module.fail_json(msg='HP iLO (%s) reports that the server is already powered on !' % host)
|
||||||
|
|
||||||
if power_status == 'ON':
|
if power_status == 'ON':
|
||||||
#ilo.cold_boot_server()
|
|
||||||
ilo.warm_boot_server()
|
ilo.warm_boot_server()
|
||||||
|
# ilo.cold_boot_server()
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
ilo.press_pwr_btn()
|
ilo.press_pwr_btn()
|
||||||
#ilo.reset_server()
|
# ilo.reset_server()
|
||||||
#ilo.set_host_power(host_power=True)
|
# ilo.set_host_power(host_power=True)
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
elif state in ('poweroff'):
|
elif state in ('poweroff'):
|
||||||
|
@ -198,7 +198,7 @@ def main():
|
||||||
|
|
||||||
if not power_status == 'OFF':
|
if not power_status == 'OFF':
|
||||||
ilo.hold_pwr_btn()
|
ilo.hold_pwr_btn()
|
||||||
#ilo.set_host_power(host_power=False)
|
# ilo.set_host_power(host_power=False)
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
module.exit_json(changed=changed, power=power_status, **status)
|
module.exit_json(changed=changed, power=power_status, **status)
|
||||||
|
|
|
@ -151,11 +151,11 @@ def parse_flat_interface(entry, non_numeric='hw_eth_ilo'):
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec=dict(
|
||||||
host = dict(required=True, type='str'),
|
host=dict(type='str', required=True),
|
||||||
login = dict(default='Administrator', type='str'),
|
login=dict(type='str', default='Administrator'),
|
||||||
password = dict(default='admin', type='str', no_log=True),
|
password=dict(type='str', default='admin', no_log=True),
|
||||||
ssl_version = dict(default='TLSv1', choices=['SSLv3', 'SSLv23', 'TLSv1', 'TLSv1_1', 'TLSv1_2']),
|
ssl_version=dict(type='str', default='TLSv1', choices=['SSLv3', 'SSLv23', 'TLSv1', 'TLSv1_1', 'TLSv1_2']),
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
|
@ -179,17 +179,17 @@ def main():
|
||||||
for entry in data:
|
for entry in data:
|
||||||
if 'type' not in entry:
|
if 'type' not in entry:
|
||||||
continue
|
continue
|
||||||
elif entry['type'] == 0: # BIOS Information
|
elif entry['type'] == 0: # BIOS Information
|
||||||
facts['hw_bios_version'] = entry['Family']
|
facts['hw_bios_version'] = entry['Family']
|
||||||
facts['hw_bios_date'] = entry['Date']
|
facts['hw_bios_date'] = entry['Date']
|
||||||
elif entry['type'] == 1: # System Information
|
elif entry['type'] == 1: # System Information
|
||||||
facts['hw_uuid'] = entry['UUID']
|
facts['hw_uuid'] = entry['UUID']
|
||||||
facts['hw_system_serial'] = entry['Serial Number'].rstrip()
|
facts['hw_system_serial'] = entry['Serial Number'].rstrip()
|
||||||
facts['hw_product_name'] = entry['Product Name']
|
facts['hw_product_name'] = entry['Product Name']
|
||||||
facts['hw_product_uuid'] = entry['cUUID']
|
facts['hw_product_uuid'] = entry['cUUID']
|
||||||
elif entry['type'] == 209: # Embedded NIC MAC Assignment
|
elif entry['type'] == 209: # Embedded NIC MAC Assignment
|
||||||
if 'fields' in entry:
|
if 'fields' in entry:
|
||||||
for (name, value) in [ (e['name'], e['value']) for e in entry['fields'] ]:
|
for (name, value) in [(e['name'], e['value']) for e in entry['fields']]:
|
||||||
if name.startswith('Port'):
|
if name.startswith('Port'):
|
||||||
try:
|
try:
|
||||||
factname = 'hw_eth' + str(int(value) - 1)
|
factname = 'hw_eth' + str(int(value) - 1)
|
||||||
|
|
|
@ -62,12 +62,13 @@ EXAMPLES = r'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec=dict(
|
||||||
src = dict(required=True, type='path', aliases=['path']),
|
src=dict(type='path', required=True, aliases=['path']),
|
||||||
minfw = dict(type='str'),
|
minfw=dict(type='str'),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -431,9 +431,6 @@ lib/ansible/modules/packaging/os/zypper.py
|
||||||
lib/ansible/modules/packaging/os/zypper_repository.py
|
lib/ansible/modules/packaging/os/zypper_repository.py
|
||||||
lib/ansible/modules/remote_management/foreman/foreman.py
|
lib/ansible/modules/remote_management/foreman/foreman.py
|
||||||
lib/ansible/modules/remote_management/foreman/katello.py
|
lib/ansible/modules/remote_management/foreman/katello.py
|
||||||
lib/ansible/modules/remote_management/hpilo/hpilo_boot.py
|
|
||||||
lib/ansible/modules/remote_management/hpilo/hpilo_facts.py
|
|
||||||
lib/ansible/modules/remote_management/hpilo/hponcfg.py
|
|
||||||
lib/ansible/modules/remote_management/stacki/stacki_host.py
|
lib/ansible/modules/remote_management/stacki/stacki_host.py
|
||||||
lib/ansible/modules/source_control/bzr.py
|
lib/ansible/modules/source_control/bzr.py
|
||||||
lib/ansible/modules/source_control/hg.py
|
lib/ansible/modules/source_control/hg.py
|
||||||
|
|
Loading…
Reference in a new issue