Removed cluster validation on client side

There is no sense in validation on client side. I believe we
don't want to have all validation logic in two places.

Also, the current validation was wrong for several reasons:
1. Wrong APIException usage (see bug description)
2. It required default_image_id for the cluster. Image could be
   set in each node group individually.
3. It required cluster_configs that is not mandatory

So, the only correct check was for node_groups field, but still
I don't think that client is the right place for checking such
things. If one day we will allow clusters with no nodegroups
client should allow that without modifications.

Change-Id: I3a7bf39b102b699e8f4a1e493314412cfd26ee2e
Closes-Bug: #1420569
This commit is contained in:
Andrew Lazarev
2015-02-11 14:47:07 -08:00
parent 18fc6a4905
commit 48df6a090b

View File

@@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import six
from saharaclient.api import base
@@ -25,12 +23,6 @@ class Cluster(base.Resource):
class ClusterManager(base.ResourceManager):
resource_class = Cluster
def _assert_variables(self, **kwargs):
for var_name, var_value in six.iteritems(kwargs):
if var_value is None:
raise base.APIException('Cluster is missing field "%s"' %
var_name)
def create(self, name, plugin_name, hadoop_version,
cluster_template_id=None, default_image_id=None,
is_transient=None, description=None, cluster_configs=None,
@@ -43,11 +35,6 @@ class ClusterManager(base.ResourceManager):
'hadoop_version': hadoop_version,
}
if cluster_template_id is None:
self._assert_variables(default_image_id=default_image_id,
cluster_configs=cluster_configs,
node_groups=node_groups)
self._copy_if_defined(data,
cluster_template_id=cluster_template_id,
is_transient=is_transient,