mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-22 12:41:05 +01:00
Added suffix .cymais to maintanance-service-lock
This commit is contained in:
parent
d8f14a9c36
commit
992745ebf6
@ -65,13 +65,19 @@ def wait_for_all_services_to_stop(filtered_services, max_attempts, attempt):
|
|||||||
def get_max_attempts(timeout_sec):
|
def get_max_attempts(timeout_sec):
|
||||||
return timeout_sec // BREAK_TIME_SECONDS
|
return timeout_sec // BREAK_TIME_SECONDS
|
||||||
|
|
||||||
|
def append_suffix_to_services(services, suffix=".cymais"):
|
||||||
|
"""
|
||||||
|
Append a specified suffix to each service name in the list.
|
||||||
|
"""
|
||||||
|
return [service + suffix for service in services]
|
||||||
|
|
||||||
def main(services, ignored_services, timeout_sec):
|
def main(services, ignored_services, timeout_sec):
|
||||||
"""
|
"""
|
||||||
Main function to process the command-line arguments and perform actions.
|
Main function to process the command-line arguments and perform actions.
|
||||||
"""
|
"""
|
||||||
|
services_with_suffix = append_suffix_to_services(services)
|
||||||
filtered_services = filter_services(services, ignored_services)
|
filtered_services = filter_services(services_with_suffix, ignored_services)
|
||||||
print(f"Services to handle: {services}")
|
print(f"Services to handle: {services_with_suffix}")
|
||||||
print(f"Services to ignore: {ignored_services}")
|
print(f"Services to ignore: {ignored_services}")
|
||||||
print(f"Services filtered: {filtered_services}")
|
print(f"Services filtered: {filtered_services}")
|
||||||
|
|
||||||
@ -83,7 +89,6 @@ def main(services, ignored_services, timeout_sec):
|
|||||||
attempt = wait_for_all_services_to_stop(filtered_services, max_attempts, attempt)
|
attempt = wait_for_all_services_to_stop(filtered_services, max_attempts, attempt)
|
||||||
print("All required services have stopped.")
|
print("All required services have stopped.")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(description='Blocks the code execution as long as defined services are running. Terminates with 0 when all services stopped')
|
parser = argparse.ArgumentParser(description='Blocks the code execution as long as defined services are running. Terminates with 0 when all services stopped')
|
||||||
parser.add_argument('services', nargs='+', help='List of services to apply the action to.')
|
parser.add_argument('services', nargs='+', help='List of services to apply the action to.')
|
||||||
|
Loading…
Reference in New Issue
Block a user