Fix ValueError for template in AppsV1beta1DeploymentSpec

Instantiating AppsV1beta1DeploymentSpec without specifying a template
will raise:
ValueError: Invalid value for `template`, must not be `None`

Therefore directly specifying the template when instantiating
AppsV1beta1DeploymentSpec and use '' as default template. This fixes the
test_create_deployments test case (fixes #46329).

Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
This commit is contained in:
Benjamin Drung 2018-03-05 14:16:40 +01:00
parent a0716643e4
commit 5008c53c44

View file

@ -1461,7 +1461,7 @@ def __dict_to_deployment_spec(spec):
'''
Converts a dictionary into kubernetes AppsV1beta1DeploymentSpec instance.
'''
spec_obj = AppsV1beta1DeploymentSpec()
spec_obj = AppsV1beta1DeploymentSpec(template=spec.get('template', ''))
for key, value in iteritems(spec):
if hasattr(spec_obj, key):
setattr(spec_obj, key, value)