Skip to content

Commit

Permalink
More working on keeping old downloads.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Harlow committed Mar 1, 2012
1 parent db338ba commit 8dc8ff6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
9 changes: 5 additions & 4 deletions devstack/component.py
Expand Up @@ -95,11 +95,11 @@ def download(self):
locations = self._get_download_locations()
base_dir = self.appdir
for location_info in locations:
uri_tuple = location_info.get("uri")
uri_tuple = location_info.get["uri"]
branch_tuple = location_info.get("branch")
subdir = location_info.get("subdir")
target_loc = None
if subdir and len(subdir):
if subdir:
target_loc = sh.joinpths(base_dir, subdir)
else:
target_loc = base_dir
Expand All @@ -109,7 +109,6 @@ def download(self):
uri = self.cfg.get(uri_tuple[0], uri_tuple[1])
self.tracewriter.downloaded(target_loc, uri)
self.tracewriter.dir_made(*down.download(target_loc, uri, branch))
self.tracewriter.downloaded(target_loc, uri)
return len(locations)

def _get_param_map(self, config_fn):
Expand Down Expand Up @@ -343,7 +342,9 @@ def _uninstall_dirs(self):
dirsmade = self.tracereader.dirs_made()
if dirsmade:
if self.keep_old:
dirsmade = sh.remove_parents(self.appdir, dirsmade)
downloads = self.tracereader.downloaded()
for info in downloads:
dirsmade = sh.remove_parents(info['target'], dirsmade)
for dirname in dirsmade:
LOG.info("Removing created directory (%s)" % (dirname))
sh.deldir(dirname, run_as_root=True)
Expand Down
1 change: 1 addition & 0 deletions devstack/settings.py
Expand Up @@ -79,6 +79,7 @@
NOVA: [KEYSTONE, GLANCE, DB, RABBIT, NOVA_CLIENT],
SWIFT: [KEYSTONE_CLIENT],
NOVA_CLIENT: [],
# Horizon depends on glances client (which should really be a client package)
HORIZON: [KEYSTONE_CLIENT, GLANCE, NOVA_CLIENT, QUANTUM_CLIENT],
# More of quantums deps come from its module function get_dependencies
QUANTUM: [],
Expand Down
10 changes: 10 additions & 0 deletions devstack/trace.py
Expand Up @@ -178,6 +178,16 @@ def _read(self):
def exists(self):
return sh.exists(self.trace_fn)

def downloaded(self):
lines = self._read()
locs = list()
for (cmd, action) in lines:
if cmd == DOWNLOADED and len(action):
jentry = json.loads(action)
if type(jentry) is dict:
locs.append(jentry)
return locs

def py_listing(self):
return self._readpy()

Expand Down

0 comments on commit 8dc8ff6

Please sign in to comment.