Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

Commit

Permalink
Merge pull request #2 from spikecurtis/profile-not-recurse
Browse files Browse the repository at this point in the history
Don't read recursive when getting profile names.
  • Loading branch information
tomdee committed Jul 30, 2015
2 parents 8c4ca00 + 26ee901 commit d5b7cf7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
3 changes: 1 addition & 2 deletions calico_containers/pycalico/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,7 @@ def get_profile_names(self):
"""
profiles = set()
try:
etcd_profiles = self.etcd_client.read(PROFILES_PATH,
recursive=True).children
etcd_profiles = self.etcd_client.read(PROFILES_PATH).children
for child in etcd_profiles:
packed = child.key.split("/")
if len(packed) > 5:
Expand Down
15 changes: 4 additions & 11 deletions calico_containers/tests/unit/datastore_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1537,15 +1537,10 @@ def mock_read_no_node_bgppeers(path):
return result


def mock_read_2_profiles(path, recursive):
def mock_read_2_profiles(path):
assert path == ALL_PROFILES_PATH
assert recursive
nodes = [CALICO_V_PATH + "/policy/profile/TEST",
CALICO_V_PATH + "/policy/profile/TEST/tags",
CALICO_V_PATH + "/policy/profile/TEST/rules",
CALICO_V_PATH + "/policy/profile/UNIT",
CALICO_V_PATH + "/policy/profile/UNIT/tags",
CALICO_V_PATH + "/policy/profile/UNIT/rules"]
CALICO_V_PATH + "/policy/profile/UNIT"]
children = []
for node in nodes:
result = Mock(spec=EtcdResult)
Expand All @@ -1556,17 +1551,15 @@ def mock_read_2_profiles(path, recursive):
return results


def mock_read_no_profiles(path, recursive):
def mock_read_no_profiles(path):
assert path == ALL_PROFILES_PATH
assert recursive
results = Mock(spec=EtcdResult)
results.children = iter([])
return results


def mock_read_profiles_key_error(path, recursive):
def mock_read_profiles_key_error(path):
assert path == ALL_PROFILES_PATH
assert recursive
raise EtcdKeyNotFound()


Expand Down

0 comments on commit d5b7cf7

Please sign in to comment.