mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 11:27:36 -02:30
Fixing pep8 issues
This commit is contained in:
@@ -22,7 +22,7 @@ no_endpoint_for_module = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Global module parameters we can ignore
|
# Global module parameters we can ignore
|
||||||
ignore_parameters = [ 'state', 'new_name' ]
|
ignore_parameters = ['state', 'new_name']
|
||||||
|
|
||||||
# Some modules take additional parameters that do not appear in the API
|
# Some modules take additional parameters that do not appear in the API
|
||||||
# Add the module name as the key with the value being the list of params to ignore
|
# Add the module name as the key with the value being the list of params to ignore
|
||||||
@@ -48,6 +48,7 @@ needs_development = [
|
|||||||
|
|
||||||
return_value = 0
|
return_value = 0
|
||||||
|
|
||||||
|
|
||||||
def determine_state(module_id, endpoint, module, parameter, api_option, module_option):
|
def determine_state(module_id, endpoint, module, parameter, api_option, module_option):
|
||||||
global return_value
|
global return_value
|
||||||
# This is a hierarchical list of things that are ok/failures based on conditions
|
# This is a hierarchical list of things that are ok/failures based on conditions
|
||||||
@@ -77,6 +78,7 @@ def determine_state(module_id, endpoint, module, parameter, api_option, module_o
|
|||||||
return_value = 255
|
return_value = 255
|
||||||
return "Failed, unknown reason"
|
return "Failed, unknown reason"
|
||||||
|
|
||||||
|
|
||||||
def test_completeness(collection_import, request, admin_user):
|
def test_completeness(collection_import, request, admin_user):
|
||||||
option_comparison = {}
|
option_comparison = {}
|
||||||
# Load a list of existing module files from disk
|
# Load a list of existing module files from disk
|
||||||
@@ -96,7 +98,10 @@ def test_completeness(collection_import, request, admin_user):
|
|||||||
'module_name': module_name,
|
'module_name': module_name,
|
||||||
}
|
}
|
||||||
resource_module = collection_import('plugins.modules.{0}'.format(module_name))
|
resource_module = collection_import('plugins.modules.{0}'.format(module_name))
|
||||||
option_comparison[module_name]['module_options'] = yaml.load(resource_module.DOCUMENTATION, Loader=yaml.SafeLoader)['options']
|
option_comparison[module_name]['module_options'] = yaml.load(
|
||||||
|
resource_module.DOCUMENTATION,
|
||||||
|
Loader=yaml.SafeLoader
|
||||||
|
)['options']
|
||||||
|
|
||||||
endpoint_response = _request('get')(
|
endpoint_response = _request('get')(
|
||||||
url='/api/v2/',
|
url='/api/v2/',
|
||||||
@@ -148,48 +153,54 @@ def test_completeness(collection_import, request, admin_user):
|
|||||||
if len(option) > longest_option_name:
|
if len(option) > longest_option_name:
|
||||||
longest_option_name = len(option)
|
longest_option_name = len(option)
|
||||||
|
|
||||||
|
|
||||||
# Print out some headers
|
# Print out some headers
|
||||||
print(
|
print(
|
||||||
"End Point", " "*(longest_endpoint-len("End Point")),
|
"End Point", " " * (longest_endpoint - len("End Point")),
|
||||||
" | Module Name", " "*(longest_module_name-len("Module Name")),
|
" | Module Name", " " * (longest_module_name - len("Module Name")),
|
||||||
" | Option", " "*(longest_option_name-len("Option")),
|
" | Option", " " * (longest_option_name - len("Option")),
|
||||||
" | API | Module | State",
|
" | API | Module | State",
|
||||||
sep=""
|
sep=""
|
||||||
)
|
)
|
||||||
print("-"*longest_endpoint, "-"*longest_module_name, "-"*longest_option_name, "---", "------", "---------------------------------------------", sep="-|-")
|
print(
|
||||||
|
"-" * longest_endpoint,
|
||||||
|
"-" * longest_module_name,
|
||||||
|
"-" * longest_option_name,
|
||||||
|
"---",
|
||||||
|
"------",
|
||||||
|
"---------------------------------------------",
|
||||||
|
sep="-|-"
|
||||||
|
)
|
||||||
|
|
||||||
# Print out all of our data
|
# Print out all of our data
|
||||||
for module in sorted(option_comparison):
|
for module in sorted(option_comparison):
|
||||||
all_param_names = list(set(option_comparison[module]['api_options']) | set(option_comparison[module]['module_options']))
|
module_data = option_comparison[module]
|
||||||
|
all_param_names = list(set(module_data['api_options']) | set(module_data['module_options']))
|
||||||
for parameter in sorted(all_param_names):
|
for parameter in sorted(all_param_names):
|
||||||
print(
|
print(
|
||||||
option_comparison[module]['endpoint'], " "*(longest_endpoint - len(option_comparison[module]['endpoint'])), " | ",
|
module_data['endpoint'], " " * (longest_endpoint - len(module_data['endpoint'])), " | ",
|
||||||
option_comparison[module]['module_name'], " "*(longest_module_name - len(option_comparison[module]['module_name'])), " | ",
|
module_data['module_name'], " " * (longest_module_name - len(module_data['module_name'])), " | ",
|
||||||
parameter, " "*(longest_option_name - len(parameter)), " | ",
|
parameter, " " * (longest_option_name - len(parameter)), " | ",
|
||||||
" X " if (parameter in option_comparison[module]['api_options']) else ' ', " | ",
|
" X " if (parameter in module_data['api_options']) else ' ', " | ",
|
||||||
' X ' if (parameter in option_comparison[module]['module_options']) else ' ', " | ",
|
' X ' if (parameter in module_data['module_options']) else ' ', " | ",
|
||||||
determine_state(
|
determine_state(
|
||||||
module,
|
module,
|
||||||
option_comparison[module]['endpoint'],
|
module_data['endpoint'],
|
||||||
option_comparison[module]['module_name'],
|
module_data['module_name'],
|
||||||
parameter,
|
parameter,
|
||||||
'X' if (parameter in option_comparison[module]['api_options']) else '',
|
'X' if (parameter in module_data['api_options']) else '',
|
||||||
'X' if (parameter in option_comparison[module]['module_options']) else '',
|
'X' if (parameter in module_data['module_options']) else '',
|
||||||
),
|
),
|
||||||
sep=""
|
sep=""
|
||||||
)
|
)
|
||||||
# This handles cases were we got no params from the options page nor from the modules
|
# This handles cases were we got no params from the options page nor from the modules
|
||||||
if len(all_param_names) == 0:
|
if len(all_param_names) == 0:
|
||||||
print(
|
print(
|
||||||
option_comparison[module]['endpoint'], " "*(longest_endpoint - len(option_comparison[module]['endpoint'])), " | ",
|
module_data['endpoint'], " " * (longest_endpoint - len(module_data['endpoint'])), " | ",
|
||||||
option_comparison[module]['module_name'], " "*(longest_module_name - len(option_comparison[module]['module_name'])), " | ",
|
module_data['module_name'], " " * (longest_module_name - len(module_data['module_name'])), " | ",
|
||||||
"N/A", " "*(longest_option_name - len("N/A")), " | ",
|
"N/A", " " * (longest_option_name - len("N/A")), " | ",
|
||||||
' ', " | ",
|
' ', " | ",
|
||||||
' ', " | ",
|
' ', " | ",
|
||||||
determine_state(
|
determine_state(module, module_data['endpoint'], module_data['module_name'], 'N/A', '', ''),
|
||||||
module, option_comparison[module]['endpoint'], option_comparison[module]['module_name'], 'N/A', '', ''
|
|
||||||
),
|
|
||||||
sep=""
|
sep=""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user