From bc3d2e04e5b6657161283e4a2499ffe3ad63552c Mon Sep 17 00:00:00 2001 From: Hui Xiang Date: Wed, 17 Dec 2014 15:01:40 +0800 Subject: [PATCH] Merge from lp:~cts-engineering/charm-helpers/quantum-gateway-ha-scale --- charm-helpers-hooks.yaml | 3 +- hooks/charmhelpers/core/host.py | 2 +- hooks/charmhelpers/fetch/giturl.py.moved | 51 ------------------------ 3 files changed, 3 insertions(+), 53 deletions(-) delete mode 100644 hooks/charmhelpers/fetch/giturl.py.moved diff --git a/charm-helpers-hooks.yaml b/charm-helpers-hooks.yaml index f3734f7d..8d3e6ab7 100644 --- a/charm-helpers-hooks.yaml +++ b/charm-helpers-hooks.yaml @@ -1,4 +1,5 @@ -branch: lp:charm-helpers +#branch: lp:charm-helpers +branch: lp:~cts-engineering/charm-helpers/quantum-gateway-ha-scale destination: hooks/charmhelpers include: - core diff --git a/hooks/charmhelpers/core/host.py b/hooks/charmhelpers/core/host.py index 6e0ae64f..5221120c 100644 --- a/hooks/charmhelpers/core/host.py +++ b/hooks/charmhelpers/core/host.py @@ -171,7 +171,7 @@ def mkdir(path, owner='root', group='root', perms=0o555, force=False): os.chown(realpath, uid, gid) elif not path_exists: os.makedirs(realpath, perms) - os.chown(realpath, uid, gid) + os.chown(realpath, uid, gid) def write_file(path, content, owner='root', group='root', perms=0o444): diff --git a/hooks/charmhelpers/fetch/giturl.py.moved b/hooks/charmhelpers/fetch/giturl.py.moved deleted file mode 100644 index f3aa2821..00000000 --- a/hooks/charmhelpers/fetch/giturl.py.moved +++ /dev/null @@ -1,51 +0,0 @@ -import os -from charmhelpers.fetch import ( - BaseFetchHandler, - UnhandledSource -) -from charmhelpers.core.host import mkdir - -import six -if six.PY3: - raise ImportError('GitPython does not support Python 3') - -try: - from git import Repo -except ImportError: - from charmhelpers.fetch import apt_install - apt_install("python-git") - from git import Repo - - -class GitUrlFetchHandler(BaseFetchHandler): - """Handler for git branches via generic and github URLs""" - def can_handle(self, source): - url_parts = self.parse_url(source) - # TODO (mattyw) no support for ssh git@ yet - if url_parts.scheme not in ('http', 'https', 'git'): - return False - else: - return True - - def clone(self, source, dest, branch): - if not self.can_handle(source): - raise UnhandledSource("Cannot handle {}".format(source)) - - repo = Repo.clone_from(source, dest) - repo.git.checkout(branch) - - def install(self, source, branch="master", dest=None): - url_parts = self.parse_url(source) - branch_name = url_parts.path.strip("/").split("/")[-1] - if dest: - dest_dir = os.path.join(dest, branch_name) - else: - dest_dir = os.path.join(os.environ.get('CHARM_DIR'), "fetched", - branch_name) - if not os.path.exists(dest_dir): - mkdir(dest_dir, perms=0o755) - try: - self.clone(source, dest_dir, branch) - except OSError as e: - raise UnhandledSource(e.strerror) - return dest_dir