mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-04 19:26:58 +00:00
Reformat everything.
This commit is contained in:
parent
3f2213791a
commit
340ff8586d
1008 changed files with 61301 additions and 58309 deletions
|
|
@ -95,29 +95,27 @@ CLOUD_INIT_PATH = "/var/lib/cloud/data"
|
|||
|
||||
|
||||
def gather_cloud_init_data_facts(module):
|
||||
res = {
|
||||
'cloud_init_data_facts': dict()
|
||||
}
|
||||
res = {"cloud_init_data_facts": dict()}
|
||||
|
||||
for i in ['result', 'status']:
|
||||
filter = module.params.get('filter')
|
||||
for i in ["result", "status"]:
|
||||
filter = module.params.get("filter")
|
||||
if filter is None or filter == i:
|
||||
res['cloud_init_data_facts'][i] = dict()
|
||||
res["cloud_init_data_facts"][i] = dict()
|
||||
json_file = os.path.join(CLOUD_INIT_PATH, f"{i}.json")
|
||||
|
||||
if os.path.exists(json_file):
|
||||
with open(json_file, 'rb') as f:
|
||||
contents = to_text(f.read(), errors='surrogate_or_strict')
|
||||
with open(json_file, "rb") as f:
|
||||
contents = to_text(f.read(), errors="surrogate_or_strict")
|
||||
|
||||
if contents:
|
||||
res['cloud_init_data_facts'][i] = module.from_json(contents)
|
||||
res["cloud_init_data_facts"][i] = module.from_json(contents)
|
||||
return res
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
filter=dict(choices=['result', 'status']),
|
||||
filter=dict(choices=["result", "status"]),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
@ -127,5 +125,5 @@ def main():
|
|||
module.exit_json(**result)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue