diff --git a/marketplace/deployer_util/config_helper.py b/marketplace/deployer_util/config_helper.py index 2fdc0116..c747781f 100644 --- a/marketplace/deployer_util/config_helper.py +++ b/marketplace/deployer_util/config_helper.py @@ -38,6 +38,7 @@ XTYPE_ISTIO_ENABLED = 'ISTIO_ENABLED' XTYPE_INGRESS_AVAILABLE = 'INGRESS_AVAILABLE' XTYPE_TLS_CERTIFICATE = 'TLS_CERTIFICATE' +XTYPE_MASKED_FIELD = 'MASKED_FIELD' WIDGET_TYPES = ['help'] @@ -520,7 +521,8 @@ def __init__(self, name, dictionary, required): xt = _must_get(self._x, 'type', 'Property {} has {} without a type'.format(name, XGOOGLE)) - if xt in (XTYPE_NAME, XTYPE_NAMESPACE, XTYPE_DEPLOYER_IMAGE): + if xt in (XTYPE_NAME, XTYPE_NAMESPACE, XTYPE_DEPLOYER_IMAGE, + XTYPE_MASKED_FIELD): _property_must_have_type(self, str) elif xt in (XTYPE_ISTIO_ENABLED, XTYPE_INGRESS_AVAILABLE): _property_must_have_type(self, bool) diff --git a/marketplace/deployer_util/config_helper_test.py b/marketplace/deployer_util/config_helper_test.py index 5163522c..6d6cbee6 100644 --- a/marketplace/deployer_util/config_helper_test.py +++ b/marketplace/deployer_util/config_helper_test.py @@ -78,6 +78,12 @@ generatedProperties: base64EncodedPrivateKey: keyEncoded base64EncodedCertificate: crtEncoded + customSecret: + title: Secret needed by the app. + description: User-entered text to be masked in the UI. + type: string + x-google-marketplace: + type: MASKED_FIELD required: - propertyString - propertyPassword @@ -129,7 +135,7 @@ def test_types_and_defaults(self): 'propertyNumberWithDefault', 'propertyBoolean', 'propertyBooleanWithDefault', 'propertyImage', 'propertyDeployerImage', 'propertyPassword', 'applicationUid', - 'istioEnabled', 'ingressAvailable', 'certificate' + 'istioEnabled', 'ingressAvailable', 'certificate', 'customSecret' }, set(schema.properties)) self.assertEqual(str, schema.properties['propertyString'].type) self.assertIsNone(schema.properties['propertyString'].default) @@ -173,6 +179,7 @@ def test_types_and_defaults(self): schema.properties['ingressAvailable'].xtype) self.assertEqual(str, schema.properties['certificate'].type) self.assertEqual('TLS_CERTIFICATE', schema.properties['certificate'].xtype) + self.assertEqual('MASKED_FIELD', schema.properties['customSecret'].xtype) def test_invalid_names(self): self.assertRaises(