credentialsId: {{ cloud_credential_id }}
endPointUrl: {{ cloud_url }}
ignoreSsl: {{ cloud_ignore_ssl }}
- name: "cattle"
+ name: {{ cloud_name }}
slaveOptions:
availabilityZone: {{ availability_zone }}
bootSource:
raise argparse.ArgumentTypeError(f"readable_dir:{path} is not a valid path")
def parse_arguments():
- parser = argparse.ArgumentParser(description='Create jcasc yaml from path to jenkins config dir.')
- parser.add_argument('--path', type=dir_path)
- parser.add_argument('--sandbox', type=bool, default=False, help="Set to True for sandbox yaml generation")
+ parser = argparse.ArgumentParser(
+ description='Create jcasc yaml from path to jenkins config dir.')
+
+
+ parser.add_argument('--path', type=dir_path,
+ help="Path to jenkins-admin directory")
+ parser.add_argument('--name', type=str,
+ help="cloud name IE: cattle")
+
+ parser.add_argument(
+ "-s", "--sandbox",
+ help = "Is configuration being created for a sandbox",
+ dest = "sandbox", action = "store_true"
+ )
+
return parser.parse_args()
parsed_args = parse_arguments()
path = (parsed_args.path)
path = ("{}**/*.cfg".format(path))
-
#sandbox switch section
section_cloud = {}
name_prefix = "prd"
# Global cloud config section
for section in config_parser_merged.sections():
if section == "cloud":
- final = (config.items(section))
+ afinal = (config.items(section))
+ name = parsed_args.name
+ final = (*afinal, ("cloud_name", name))
for index, _ in enumerate(final):
print(j2_template.render(section_all_machines))
-
#Footer section
j2_template = Template(footertemplate)
print(j2_template.render(section_cloud))