Chore: Upgrade Jenkins-job-builder to 6.3.0
[releng/global-jjb.git] / jenkins-admin / create_jenkins_clouds_openstack_yaml.py
index 2b81f34..d342469 100755 (executable)
@@ -93,9 +93,10 @@ jenkins:
         slaveOptions:
           availabilityZone: {{ availability_zone }}
           bootSource:
-            volumeFromImage:
+            {{ image_type }}:
               name: {{ image_name }}
-              volumeSize: {{ volume_size }}
+{%- if image_type == "volumeFromImage"  %}
+              volumeSize: {{ volume_size }}{% endif %}
           fsRoot: {{ fs_root }}
           hardwareId: {{ hardware_id }}
 {%- if is_sandbox is defined %}
@@ -125,7 +126,7 @@ machinetemplate = """\
 {%- if instance_cap %}
               instanceCap: {{ instance_cap }}{% endif %}
 {%- if num_executors %}
-              numExectorts: {{ num_executors }}{% endif %}
+              numExecutors: {{ num_executors }}{% endif %}
 {%- if retention_time %}
               retentionTime: {{ retention_time }}
 {%- else %}
@@ -201,6 +202,11 @@ for index, _ in enumerate(cloud_config_final):
         value = lookuptable[value]
     section_cloud[key] = value
 
+    if "volume_size" not in section_cloud:
+        section_cloud.update(image_type="image")
+    else:
+        section_cloud.update(image_type="volumeFromImage")
+
 j2_template = Template(maintemplate)
 print(j2_template.render(section_cloud))