Do your housekeeping 74/13374/1
authorMartin Skorupski <martin.skorupski@highstreet-technologies.com>
Sat, 21 Sep 2024 13:01:13 +0000 (15:01 +0200)
committerMartin Skorupski <martin.skorupski@highstreet-technologies.com>
Sat, 21 Sep 2024 13:01:18 +0000 (15:01 +0200)
- spelling

Issue-ID: OAM-411
Change-Id: Ifa34767d6891cfc1ba93168eaafaba0c2d126af8
Signed-off-by: Martin Skorupski <martin.skorupski@highstreet-technologies.com>
solution/adopt_to_environment.py

index 9b531cc..5dade68 100755 (executable)
@@ -1,6 +1,6 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 ################################################################################
-# Copyright 2023 highstreet technologies GmbH
+# Copyright 2024 highstreet technologies 
 #
 # Licensed under the Apache License, Version 2.0 (the 'License');
 # you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@ file_extensions = ['.env', '.yaml', '.json']
 
 parser = argparse.ArgumentParser(script_name)
 required = parser.add_argument_group('required named arguments')
-required.add_argument("-i", "--ip_address", help="The remote accessable IP address of this system.",
+required.add_argument("-i", "--ip_address", help="The remote accessible IP address of this system.",
                       type=str, required=True)
 parser.add_argument("-d", "--http_domain", help="The http domain. Default is " +
                     default_http_domain + ".",
@@ -50,10 +50,12 @@ def find_replace(directory, find_text, replace_text, extensions):
                         with open(file_path, 'w') as file:
                             file.write(updated_content)
                         print(f"Replaced '{find_text}' with '{replace_text}' in '{file_path}'")
-def create_etc_hosts(ip_adress_v4: str, http_domain: str ) -> None:
+
+
+def create_etc_hosts(ip_address_v4: str, http_domain: str ) -> None:
     """
-    creates scelaton for /etc/hosts and writes to local file
-    @param ip_adress: ipv4 address of the system
+    creates skelton for /etc/hosts and writes to local file
+    @param ip_address: ipv4 address of the system
     @param http_domain: base domain name for the deployment
     """
     template_str = """
@@ -71,7 +73,7 @@ def create_etc_hosts(ip_adress_v4: str, http_domain: str ) -> None:
 
 """
     template = Template(template_str)
-    hosts_entries: str = template.render(deployment_system_ipv4=ip_adress_v4,
+    hosts_entries: str = template.render(deployment_system_ipv4=ip_address_v4,
                                          http_domain=http_domain)
     output_txt_path = f"{directory_path}/append_to_etc_hosts.txt"
     with open(output_txt_path, 'w', encoding="utf-8") as f:
@@ -86,7 +88,7 @@ if args.revert == False:
     if not args.http_domain == default_http_domain:
         find_replace(directory_path, default_http_domain, args.http_domain, file_extensions)
     # write append file for etc/hosts
-    create_etc_hosts(ip_adress_v4=args.ip_address, http_domain=args.http_domain)
+    create_etc_hosts(ip_address_v4=args.ip_address, http_domain=args.http_domain)
 else:
     # revert back ip
     find_replace(directory_path, args.ip_address, default_ip_address, file_extensions)