mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-16 01:45:25 -07:00
pep8 fixes for contrib (#24344)
This commit is contained in:
parent
c7ae6b9fd5
commit
d3249e7875
37 changed files with 326 additions and 380 deletions
|
@ -38,10 +38,12 @@ from six import iteritems
|
|||
|
||||
from ansible.module_utils.urls import open_url
|
||||
|
||||
|
||||
class ProxmoxNodeList(list):
|
||||
def get_names(self):
|
||||
return [node['node'] for node in self]
|
||||
|
||||
|
||||
class ProxmoxVM(dict):
|
||||
def get_variables(self):
|
||||
variables = {}
|
||||
|
@ -49,6 +51,7 @@ class ProxmoxVM(dict):
|
|||
variables['proxmox_' + key] = value
|
||||
return variables
|
||||
|
||||
|
||||
class ProxmoxVMList(list):
|
||||
def __init__(self, data=[]):
|
||||
for item in data:
|
||||
|
@ -68,14 +71,17 @@ class ProxmoxVMList(list):
|
|||
|
||||
return variables
|
||||
|
||||
|
||||
class ProxmoxPoolList(list):
|
||||
def get_names(self):
|
||||
return [pool['poolid'] for pool in self]
|
||||
|
||||
|
||||
class ProxmoxPool(dict):
|
||||
def get_members_name(self):
|
||||
return [member['name'] for member in self['members'] if member['template'] != 1]
|
||||
|
||||
|
||||
class ProxmoxAPI(object):
|
||||
def __init__(self, options):
|
||||
self.options = options
|
||||
|
@ -139,6 +145,7 @@ class ProxmoxAPI(object):
|
|||
def pool(self, poolid):
|
||||
return ProxmoxPool(self.get('api2/json/pools/{}'.format(poolid)))
|
||||
|
||||
|
||||
def main_list(options):
|
||||
results = {
|
||||
'all': {
|
||||
|
@ -199,6 +206,7 @@ def main_list(options):
|
|||
|
||||
return results
|
||||
|
||||
|
||||
def main_host(options):
|
||||
proxmox_api = ProxmoxAPI(options)
|
||||
proxmox_api.auth()
|
||||
|
@ -211,6 +219,7 @@ def main_host(options):
|
|||
|
||||
return {}
|
||||
|
||||
|
||||
def main():
|
||||
parser = OptionParser(usage='%prog [options] --list | --host HOSTNAME')
|
||||
parser.add_option('--list', action="store_true", default=False, dest="list")
|
||||
|
@ -235,5 +244,6 @@ def main():
|
|||
|
||||
print(json.dumps(data, indent=indent))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue