mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-04 07:51:50 +00:00
Reformat everything.
This commit is contained in:
parent
3f2213791a
commit
340ff8586d
1008 changed files with 61301 additions and 58309 deletions
|
|
@ -258,16 +258,16 @@ def get_unit_properties(runner, prop_list, unit):
|
|||
|
||||
|
||||
def determine_category(unit):
|
||||
if unit.endswith('.service'):
|
||||
return 'service'
|
||||
elif unit.endswith('.target'):
|
||||
return 'target'
|
||||
elif unit.endswith('.socket'):
|
||||
return 'socket'
|
||||
elif unit.endswith('.mount'):
|
||||
return 'mount'
|
||||
elif unit.endswith('.timer'):
|
||||
return 'timer'
|
||||
if unit.endswith(".service"):
|
||||
return "service"
|
||||
elif unit.endswith(".target"):
|
||||
return "target"
|
||||
elif unit.endswith(".socket"):
|
||||
return "socket"
|
||||
elif unit.endswith(".mount"):
|
||||
return "mount"
|
||||
elif unit.endswith(".timer"):
|
||||
return "timer"
|
||||
else:
|
||||
return None
|
||||
|
||||
|
|
@ -285,11 +285,11 @@ def unit_exists(unit, units_info):
|
|||
|
||||
def get_category_base_props(category):
|
||||
base_props = {
|
||||
'service': ['FragmentPath', 'UnitFileState', 'UnitFilePreset', 'MainPID', 'ExecMainPID'],
|
||||
'target': ['FragmentPath', 'UnitFileState', 'UnitFilePreset'],
|
||||
'socket': ['FragmentPath', 'UnitFileState', 'UnitFilePreset'],
|
||||
'mount': ['Where', 'What', 'Options', 'Type'],
|
||||
'timer': ['FragmentPath', 'UnitFileState', 'UnitFilePreset'],
|
||||
"service": ["FragmentPath", "UnitFileState", "UnitFilePreset", "MainPID", "ExecMainPID"],
|
||||
"target": ["FragmentPath", "UnitFileState", "UnitFilePreset"],
|
||||
"socket": ["FragmentPath", "UnitFileState", "UnitFilePreset"],
|
||||
"mount": ["Where", "What", "Options", "Type"],
|
||||
"timer": ["FragmentPath", "UnitFileState", "UnitFilePreset"],
|
||||
}
|
||||
return base_props.get(category, [])
|
||||
|
||||
|
|
@ -303,7 +303,7 @@ def validate_unit_and_properties(runner, unit, extra_properties, units_info, pro
|
|||
if not category:
|
||||
module.fail_json(msg=f"Could not determine the category for unit '{unit}'.")
|
||||
|
||||
state_props = ['LoadState', 'ActiveState', 'SubState']
|
||||
state_props = ["LoadState", "ActiveState", "SubState"]
|
||||
props = get_category_base_props(category)
|
||||
full_props = set(props + state_props + extra_properties)
|
||||
|
||||
|
|
@ -365,17 +365,17 @@ def process_unit(runner, unit, extra_properties, units_info, property_cache, sta
|
|||
def main():
|
||||
global module
|
||||
module_args = dict(
|
||||
unitname=dict(type='list', elements='str', default=[]),
|
||||
extra_properties=dict(type='list', elements='str', default=[])
|
||||
unitname=dict(type="list", elements="str", default=[]),
|
||||
extra_properties=dict(type="list", elements="str", default=[]),
|
||||
)
|
||||
module = AnsibleModule(argument_spec=module_args, supports_check_mode=True)
|
||||
systemctl_bin = module.get_bin_path('systemctl', required=True)
|
||||
systemctl_bin = module.get_bin_path("systemctl", required=True)
|
||||
|
||||
base_runner = systemd_runner(module, systemctl_bin)
|
||||
|
||||
get_version(base_runner)
|
||||
|
||||
state_props = ['LoadState', 'ActiveState', 'SubState']
|
||||
state_props = ["LoadState", "ActiveState", "SubState"]
|
||||
results = {}
|
||||
|
||||
unit_types = ["service", "target", "socket", "mount", "timer"]
|
||||
|
|
@ -398,10 +398,10 @@ def main():
|
|||
}
|
||||
|
||||
property_cache = {}
|
||||
extra_properties = module.params['extra_properties']
|
||||
extra_properties = module.params["extra_properties"]
|
||||
|
||||
if module.params['unitname']:
|
||||
selected_units = module.params['unitname']
|
||||
if module.params["unitname"]:
|
||||
selected_units = module.params["unitname"]
|
||||
all_units = list(units_info)
|
||||
resolved_units, non_matching = process_wildcards(selected_units, all_units, module)
|
||||
units_to_process = sorted(resolved_units)
|
||||
|
|
@ -413,5 +413,5 @@ def main():
|
|||
module.exit_json(changed=False, units=results)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue