mirror of
https://github.com/ansible/awx.git
synced 2026-04-19 08:50:21 -02:30
move code linting to a stricter pep8-esque auto-formatting tool, black
This commit is contained in:
@@ -46,17 +46,12 @@ def get_mem_capacity():
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec = dict()
|
||||
)
|
||||
module = AnsibleModule(argument_spec=dict())
|
||||
|
||||
ar = module.get_bin_path('ansible-runner', required=True)
|
||||
|
||||
try:
|
||||
version = subprocess.check_output(
|
||||
[ar, '--version'],
|
||||
stderr=subprocess.STDOUT
|
||||
).strip()
|
||||
version = subprocess.check_output([ar, '--version'], stderr=subprocess.STDOUT).strip()
|
||||
except subprocess.CalledProcessError as e:
|
||||
module.fail_json(msg=to_text(e))
|
||||
return
|
||||
@@ -65,15 +60,13 @@ def main():
|
||||
mem, capacity_mem = get_mem_capacity()
|
||||
|
||||
# Module never results in a change
|
||||
module.exit_json(changed=False, capacity_cpu=capacity_cpu,
|
||||
capacity_mem=capacity_mem, version=version,
|
||||
ansible_facts=dict(
|
||||
awx_cpu=cpu,
|
||||
awx_mem=mem,
|
||||
awx_capacity_cpu=capacity_cpu,
|
||||
awx_capacity_mem=capacity_mem,
|
||||
awx_capacity_version=version
|
||||
))
|
||||
module.exit_json(
|
||||
changed=False,
|
||||
capacity_cpu=capacity_cpu,
|
||||
capacity_mem=capacity_mem,
|
||||
version=version,
|
||||
ansible_facts=dict(awx_cpu=cpu, awx_mem=mem, awx_capacity_cpu=capacity_cpu, awx_capacity_mem=capacity_mem, awx_capacity_version=version),
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -26,9 +26,7 @@ import subprocess
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec = dict()
|
||||
)
|
||||
module = AnsibleModule(argument_spec=dict())
|
||||
changed = False
|
||||
paths_removed = set([])
|
||||
|
||||
@@ -38,9 +36,7 @@ def main():
|
||||
# this datetime, then it will be deleted because its job has finished
|
||||
job_cutoff = datetime.datetime.now() - datetime.timedelta(hours=1)
|
||||
|
||||
for search_pattern in [
|
||||
'/tmp/awx_[0-9]*_*', '/tmp/ansible_runner_pi_*',
|
||||
]:
|
||||
for search_pattern in ['/tmp/awx_[0-9]*_*', '/tmp/ansible_runner_pi_*']:
|
||||
for path in glob.iglob(search_pattern):
|
||||
st = os.stat(path)
|
||||
modtime = datetime.datetime.fromtimestamp(st.st_mtime)
|
||||
|
||||
@@ -11,13 +11,7 @@ from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec={
|
||||
'path': {'required': True, 'type': 'str'},
|
||||
'content': {'required': True, 'type': 'str'}
|
||||
},
|
||||
supports_check_mode=False
|
||||
)
|
||||
module = AnsibleModule(argument_spec={'path': {'required': True, 'type': 'str'}, 'content': {'required': True, 'type': 'str'}}, supports_check_mode=False)
|
||||
|
||||
path = module.params['path']
|
||||
os.chmod(path, stat.S_IRUSR | stat.S_IWUSR)
|
||||
|
||||
Reference in New Issue
Block a user