Added update of git and fix for rc generation.

This commit is contained in:
Joshua Harlow 2012-02-29 12:16:04 -08:00
parent ecaa860534
commit 56bfb889bb
2 changed files with 17 additions and 21 deletions

View File

@ -26,28 +26,27 @@ LOG = logging.getLogger("devstack.downloader")
EXT_REG = re.compile(r"^(.*?)\.git\s*$", re.IGNORECASE)
GIT_MASTER_BRANCH = "master"
GIT_CACHE_DIR_ENV = "GIT_CACHE_DIR"
def _git_cache_download(storewhere, uri, branch=None):
cdir = env.get_key(GIT_CACHE_DIR_ENV)
if cdir and sh.isdir(cdir):
#TODO actually do the cache...
pass
return False
CLONE_CMD = ["git", "clone"]
CHECKOUT_CMD = ['git', 'checkout']
PULL_CMD = ['git', 'pull']
def _gitdownload(storewhere, uri, branch=None):
dirsmade = sh.mkdirslist(storewhere)
dirsmade = list()
if sh.isdir(storewhere):
LOG.info("Updating %s" % (uri, storewhere))
cmd = CHECKOUT_CMD + [GIT_MASTER_BRANCH]
sh.execute(*cmd, cwd=storewhere)
cmd = PULL_CMD
sh.execute(*cmd, cwd=storewhere)
else:
LOG.info("Downloading from %s to %s" % (uri, storewhere))
#check if already done
if _git_cache_download(storewhere, uri, branch):
return dirsmade
#have to do it...
cmd = ["git", "clone"] + [uri, storewhere]
dirsmade.extend(sh.mkdirslist(storewhere))
cmd = CLONE_CMD + [uri, storewhere]
sh.execute(*cmd)
if branch and branch != GIT_MASTER_BRANCH:
LOG.info("Adjusting git branch to %s" % (branch))
cmd = ['git', 'checkout'] + [branch]
cmd = CHECKOUT_CMD + [branch]
sh.execute(*cmd, cwd=storewhere)
return dirsmade

View File

@ -29,7 +29,7 @@ LOG = logging.getLogger("devstack.progs.actions")
_REVERSE_ACTIONS = [settings.UNINSTALL, settings.STOP]
# For these actions we will attempt to make an rc file if it does not exist
_RC_FILE_MAKE_ACTIONS = [settings.INSTALL, settings.START]
_RC_FILE_MAKE_ACTIONS = [settings.INSTALL]
# The order of which uninstalls happen + message of what is happening (before and after)
UNINSTALL_ORDERING = [
@ -204,7 +204,6 @@ class ActionRunner(object):
preq_runner = ActionRunner(self.distro, preq_action,
self.directory, self.cfg, self.pkg_manager,
components=preq_components, **self.kargs)
preq_runner.rc_file = self.rc_file
preq_runner.run()
def _pre_run(self, instances, component_order):
@ -231,8 +230,6 @@ class ActionRunner(object):
creator = env_rc.RcGenerator(self.cfg)
contents = creator.generate()
sh.write_file(self.rc_file, contents)
if self.rc_file:
self.rc_file = None
def _run_instances(self, instances, component_order):
component_order = self._apply_reverse(component_order)