From 049e64a4408d6ff6ef0d3e8d10f8433e8271e991 Mon Sep 17 00:00:00 2001 From: Dmitry Mescheryakov Date: Tue, 3 Jun 2014 17:37:13 +0400 Subject: [PATCH] Remove usage of remote from HDP Instance constructor When Sahara is run in distributed mode, the Instance object is used in sahara-api context. You can see the full stack trace in the bug description. Here it is in the simplified form: * User requests HDP cluster scaling * Scaling validation (in HDP plugin) * HDP Instance objects are constructed * Sahara's instance.remote() is called inside the constructor The remote is unavalable in sahara-api context and that causes the issue. Moving invokation of instance.remote() out of constructor fixes it. Change-Id: I0d09c7a19e4df7fce948994fb21028fe147d2782 Closes-bug: #1325989 --- sahara/plugins/hdp/clusterspec.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/sahara/plugins/hdp/clusterspec.py b/sahara/plugins/hdp/clusterspec.py index bb75386a..cc89dadc 100644 --- a/sahara/plugins/hdp/clusterspec.py +++ b/sahara/plugins/hdp/clusterspec.py @@ -175,10 +175,7 @@ class ClusterSpec(): node_group.components = ng.node_processes[:] node_group.ng_storage_paths = ng.storage_paths() for instance in ng.instances: - node_group.instances.add(Instance(instance.fqdn(), - instance.management_ip, - instance.internal_ip, - instance.remote())) + node_group.instances.add(Instance(instance)) self.node_groups[node_group.name] = node_group def _determine_deployed_services(self, cluster): @@ -249,17 +246,17 @@ class User(): class Instance(): - def __init__(self, fqdn, management_ip, internal_ip, remote): - self.inst_fqdn = fqdn - self.management_ip = management_ip - self.internal_ip = internal_ip - self.inst_remote = remote + def __init__(self, sahara_instance): + self.inst_fqdn = sahara_instance.fqdn() + self.management_ip = sahara_instance.management_ip + self.internal_ip = sahara_instance.internal_ip + self.sahara_instance = sahara_instance def fqdn(self): return self.inst_fqdn def remote(self): - return self.inst_remote + return self.sahara_instance.remote() def __hash__(self): return hash(self.fqdn())