Skip to content

Commit

Permalink
temp commit
Browse files Browse the repository at this point in the history
  • Loading branch information
whynick1 committed Jan 18, 2019
1 parent b495a36 commit 32b566a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
3 changes: 3 additions & 0 deletions ducktape/cluster/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def name(self):
def operating_system(self):
return self.account.operating_system

@property
def type(self):
return self.account.host_type

class Cluster(object):
""" Interface for a cluster -- a collection of nodes with login credentials.
Expand Down
16 changes: 4 additions & 12 deletions ducktape/cluster/finite_subcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import re
from collections import defaultdict
from ducktape.cluster.cluster import Cluster
from ducktape.cluster.cluster_spec import ClusterSpec
Expand Down Expand Up @@ -40,12 +39,8 @@ def alloc(self, cluster_spec, node_type=None):
return allocated

def free_single(self, node):
if re.match(self.NODE_PATTERN, node.name) is not None:
node_type = re.search(self.NODE_PATTERN, node.name).group(1)
else:
node_type = node.name
self._in_use_nodes_dict[node_type].remove_node(node)
self._available_nodes_dict[node_type].add_node(node)
self._in_use_nodes_dict[node.type].remove_node(node)
self._available_nodes_dict[node.type].add_node(node)

def available(self):
available_nodes = NodeContainer()
Expand All @@ -64,9 +59,6 @@ def used(self):
def _get_available_nodes_dict(self, nodes):
available_nodes_dict = defaultdict(NodeContainer)
for node in nodes:
if re.match(self.NODE_PATTERN, node.name) is not None:
node_type = re.search(self.NODE_PATTERN, node.name).group(1)
else:
node_type = None
available_nodes_dict[node_type].add_node(node)
print("available_nodes_dict[{node_type}].add_node()".format(node_type = node.type))
available_nodes_dict[node.type].add_node(node)
return available_nodes_dict
6 changes: 6 additions & 0 deletions ducktape/cluster/remoteaccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import stat
import tempfile
import warnings
import re

from ducktape.utils.http_utils import HttpMixin
from ducktape.utils.util import wait_until
Expand Down Expand Up @@ -144,6 +145,11 @@ def __init__(self, ssh_config, externally_routable_ip=None, logger=None):
def operating_system(self):
return self.os

@property
def host_type(self):
m = re.search("(.+)-([0-9]+)", self.hostname)
return m.group(1) if m else self.hostname

@property
def logger(self):
if self._logger:
Expand Down

0 comments on commit 32b566a

Please sign in to comment.