Ver Fonte

lib/base: Allow for more complex template params

This change allows for the specification of JSON objects like
lists as parameters to templates.

Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
Jose A. Rivera há 8 anos atrás
pai
commit
c20195d037
28 ficheiros alterados com 28 adições e 28 exclusões
  1. 1 1
      roles/lib_openshift/library/oc_adm_ca_server_cert.py
  2. 1 1
      roles/lib_openshift/library/oc_adm_manage_node.py
  3. 1 1
      roles/lib_openshift/library/oc_adm_policy_group.py
  4. 1 1
      roles/lib_openshift/library/oc_adm_policy_user.py
  5. 1 1
      roles/lib_openshift/library/oc_adm_registry.py
  6. 1 1
      roles/lib_openshift/library/oc_adm_router.py
  7. 1 1
      roles/lib_openshift/library/oc_clusterrole.py
  8. 1 1
      roles/lib_openshift/library/oc_configmap.py
  9. 1 1
      roles/lib_openshift/library/oc_edit.py
  10. 1 1
      roles/lib_openshift/library/oc_env.py
  11. 1 1
      roles/lib_openshift/library/oc_group.py
  12. 1 1
      roles/lib_openshift/library/oc_image.py
  13. 1 1
      roles/lib_openshift/library/oc_label.py
  14. 1 1
      roles/lib_openshift/library/oc_obj.py
  15. 1 1
      roles/lib_openshift/library/oc_objectvalidator.py
  16. 1 1
      roles/lib_openshift/library/oc_process.py
  17. 1 1
      roles/lib_openshift/library/oc_project.py
  18. 1 1
      roles/lib_openshift/library/oc_pvc.py
  19. 1 1
      roles/lib_openshift/library/oc_route.py
  20. 1 1
      roles/lib_openshift/library/oc_scale.py
  21. 1 1
      roles/lib_openshift/library/oc_secret.py
  22. 1 1
      roles/lib_openshift/library/oc_service.py
  23. 1 1
      roles/lib_openshift/library/oc_serviceaccount.py
  24. 1 1
      roles/lib_openshift/library/oc_serviceaccount_secret.py
  25. 1 1
      roles/lib_openshift/library/oc_user.py
  26. 1 1
      roles/lib_openshift/library/oc_version.py
  27. 1 1
      roles/lib_openshift/library/oc_volume.py
  28. 1 1
      roles/lib_openshift/src/lib/base.py

+ 1 - 1
roles/lib_openshift/library/oc_adm_ca_server_cert.py

@@ -952,7 +952,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_adm_manage_node.py

@@ -938,7 +938,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_adm_policy_group.py

@@ -924,7 +924,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_adm_policy_user.py

@@ -924,7 +924,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_adm_registry.py

@@ -1042,7 +1042,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_adm_router.py

@@ -1067,7 +1067,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_clusterrole.py

@@ -916,7 +916,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_configmap.py

@@ -922,7 +922,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_edit.py

@@ -966,7 +966,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_env.py

@@ -933,7 +933,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_group.py

@@ -906,7 +906,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_image.py

@@ -925,7 +925,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_label.py

@@ -942,7 +942,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_obj.py

@@ -945,7 +945,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_objectvalidator.py

@@ -877,7 +877,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_process.py

@@ -934,7 +934,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_project.py

@@ -931,7 +931,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_pvc.py

@@ -926,7 +926,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_route.py

@@ -976,7 +976,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_scale.py

@@ -920,7 +920,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_secret.py

@@ -966,7 +966,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_service.py

@@ -972,7 +972,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_serviceaccount.py

@@ -918,7 +918,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_serviceaccount_secret.py

@@ -918,7 +918,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_user.py

@@ -978,7 +978,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_version.py

@@ -890,7 +890,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/library/oc_volume.py

@@ -967,7 +967,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)
 

+ 1 - 1
roles/lib_openshift/src/lib/base.py

@@ -128,7 +128,7 @@ class OpenShiftCLI(object):
         else:
             cmd.append(template_name)
         if params:
-            param_str = ["{}={}".format(key, value) for key, value in params.items()]
+            param_str = ["{}={}".format(key, str(value).replace("'", r'"')) for key, value in params.items()]
             cmd.append('-v')
             cmd.extend(param_str)