-#!/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.
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 + ".",
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 = """
"""
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:
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)