Step to reproduce:
Create cluster_template via python-saharaclient:
saharaclient.cluster_templates.create(
'clstr-tmpl',
'vanilla',
'1.2.1'
description='test cluster template',
cluster_configs={
'HDFS': {'dfs.replication': 2},
'MapReduce': {'mapred.child.java.opts': '-Xmx100m'},
'general': {'Enable Swift': True},
},
node_groups=[
dict(
name='test-master-node-jt-nn',
flavor_id=<flavor_id>,
node_processes=['namenode', 'jobtracker'],
node_configs={
'HDFS': self.NN_CONFIG,
'MapReduce': self.JT_CONFIG
},
floating_ip_pool=floating_ip_pool,
count=1),
dict(
name='test-worker-node-tt-dn',
node_group_template_id=<ID_ngt>,
count=1),
],
anti_affinity=[]
)
Expected result: cluster in created
Actual result: APIExeption
APIException: {u'count': 1, u'name': u'ostf-test-master-node-jt-nn', u'floating_ip_pool': None, u'node_configs': {u'HDFS': {u'Name Node Heap Size': 512}, u'MapReduce': {u'Job Tracker Heap Size': 514}}, u'flavor_id': u'ee15c908-12be-418b-88a8-685cda82b741', u'node_processes': [u'namenode', u'jobtracker']} is not valid under any of the given schemas
----------------------------
Sahara log:
2014-04-30 10:01:40.347 18158 DEBUG sahara.utils.api [-] Validation Error occurred: error_code=400, error_message={u'count': 1, u'name': u'master', u'floating_ip_pool': None, u'node_configs': {}, u'flavor_id': u'42', u'node_processes': [u'namenode']} is not valid under any of the given schemas, error_name=VALIDATION_ERROR bad_request /usr/lib/python2.7/dist-packages/sahara/utils/api.py:239
2014-04-30 10:01:40.348 18158 INFO sahara.cli.sahara_api [-] 10.20.1.3 - - [30/Apr/2014 10:01:40] "POST /v1.0/5cf8535329fb46f6ad5f203a8111c808/cluster-templates HTTP/1.1" 400 551 0.005293
That's a bug in python-saharaclient because _copy_if_defined() method don't work for nested dicts like None fields of "node_groups" in Cluster object.