Skip Metadata Capture on unsupported Clouds
[releng/global-jjb.git] / jenkins-admin / create_jenkins_clouds_openstack_yaml.py
index 2d81a25..ea92aa7 100755 (executable)
@@ -58,7 +58,7 @@ jenkins:
         credentialsId: {{ cloud_credential_id }}
         endPointUrl: {{ cloud_url }}
         ignoreSsl: {{ cloud_ignore_ssl }}
-        name: "cattle"
+        name: {{ cloud_name }}
         slaveOptions:
           availabilityZone: {{ availability_zone }}
           bootSource:
@@ -117,8 +117,15 @@ def parse_arguments():
 
     parser.add_argument('--path', type=dir_path,
                         help="Path to jenkins-admin directory")
-    parser.add_argument('--sandbox', type=bool, default=False,
-                        help="Set to True for sandbox yaml generation")
+    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()
@@ -173,7 +180,9 @@ for filename in glob.iglob(path, recursive=True):
 # 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):