Merge lp:~corey.bryant/charms/trusty/ceph/contrib.python.packages into lp:~openstack-charmers-archive/charms/trusty/ceph/next

Proposed by Corey Bryant
Status: Merged
Merged at revision: 91
Proposed branch: lp:~corey.bryant/charms/trusty/ceph/contrib.python.packages
Merge into: lp:~openstack-charmers-archive/charms/trusty/ceph/next
Diff against target: 204 lines (+65/-31)
6 files modified
charm-helpers-hooks.yaml (+0/-1)
hooks/charmhelpers/__init__.py (+0/-22)
hooks/charmhelpers/core/hookenv.py (+16/-4)
hooks/charmhelpers/core/host.py (+21/-1)
hooks/charmhelpers/fetch/giturl.py (+6/-3)
tests/charmhelpers/__init__.py (+22/-0)
To merge this branch: bzr merge lp:~corey.bryant/charms/trusty/ceph/contrib.python.packages
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+244476@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Corey Bryant (corey.bryant) wrote :

Charm-helpers now pulls in charmhelpers/__init__.py automatically.

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #221 ceph-next for corey.bryant mp244476
    LINT OK: passed

Build: http://10.230.18.80:8080/job/charm_lint_check/221/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #184 ceph-next for corey.bryant mp244476
    UNIT OK: passed

Build: http://10.230.18.80:8080/job/charm_unit_test/184/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #138 ceph-next for corey.bryant mp244476
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
  ERROR subprocess encountered error code 1
  make: *** [test] Error 1

Full amulet test output: pastebin not avail., cmd error
Build: http://10.230.18.80:8080/job/charm_amulet_test/138/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'charm-helpers-hooks.yaml'
--- charm-helpers-hooks.yaml 2014-12-01 17:35:21 +0000
+++ charm-helpers-hooks.yaml 2014-12-11 17:56:06 +0000
@@ -1,7 +1,6 @@
1branch: lp:charm-helpers1branch: lp:charm-helpers
2destination: hooks/charmhelpers2destination: hooks/charmhelpers
3include:3include:
4 - __init__
5 - core4 - core
6 - fetch5 - fetch
7 - contrib.storage.linux:6 - contrib.storage.linux:
87
=== added file 'hooks/charmhelpers/__init__.py'
--- hooks/charmhelpers/__init__.py 1970-01-01 00:00:00 +0000
+++ hooks/charmhelpers/__init__.py 2014-12-11 17:56:06 +0000
@@ -0,0 +1,22 @@
1# Bootstrap charm-helpers, installing its dependencies if necessary using
2# only standard libraries.
3import subprocess
4import sys
5
6try:
7 import six # flake8: noqa
8except ImportError:
9 if sys.version_info.major == 2:
10 subprocess.check_call(['apt-get', 'install', '-y', 'python-six'])
11 else:
12 subprocess.check_call(['apt-get', 'install', '-y', 'python3-six'])
13 import six # flake8: noqa
14
15try:
16 import yaml # flake8: noqa
17except ImportError:
18 if sys.version_info.major == 2:
19 subprocess.check_call(['apt-get', 'install', '-y', 'python-yaml'])
20 else:
21 subprocess.check_call(['apt-get', 'install', '-y', 'python3-yaml'])
22 import yaml # flake8: noqa
023
=== removed file 'hooks/charmhelpers/__init__.py'
--- hooks/charmhelpers/__init__.py 2014-12-01 17:35:21 +0000
+++ hooks/charmhelpers/__init__.py 1970-01-01 00:00:00 +0000
@@ -1,22 +0,0 @@
1# Bootstrap charm-helpers, installing its dependencies if necessary using
2# only standard libraries.
3import subprocess
4import sys
5
6try:
7 import six # flake8: noqa
8except ImportError:
9 if sys.version_info.major == 2:
10 subprocess.check_call(['apt-get', 'install', '-y', 'python-six'])
11 else:
12 subprocess.check_call(['apt-get', 'install', '-y', 'python3-six'])
13 import six # flake8: noqa
14
15try:
16 import yaml # flake8: noqa
17except ImportError:
18 if sys.version_info.major == 2:
19 subprocess.check_call(['apt-get', 'install', '-y', 'python-yaml'])
20 else:
21 subprocess.check_call(['apt-get', 'install', '-y', 'python3-yaml'])
22 import yaml # flake8: noqa
230
=== modified file 'hooks/charmhelpers/core/hookenv.py'
--- hooks/charmhelpers/core/hookenv.py 2014-11-26 09:07:27 +0000
+++ hooks/charmhelpers/core/hookenv.py 2014-12-11 17:56:06 +0000
@@ -68,6 +68,8 @@
68 command = ['juju-log']68 command = ['juju-log']
69 if level:69 if level:
70 command += ['-l', level]70 command += ['-l', level]
71 if not isinstance(message, six.string_types):
72 message = repr(message)
71 command += [message]73 command += [message]
72 subprocess.call(command)74 subprocess.call(command)
7375
@@ -394,21 +396,31 @@
394396
395397
396@cached398@cached
399def metadata():
400 """Get the current charm metadata.yaml contents as a python object"""
401 with open(os.path.join(charm_dir(), 'metadata.yaml')) as md:
402 return yaml.safe_load(md)
403
404
405@cached
397def relation_types():406def relation_types():
398 """Get a list of relation types supported by this charm"""407 """Get a list of relation types supported by this charm"""
399 charmdir = os.environ.get('CHARM_DIR', '')
400 mdf = open(os.path.join(charmdir, 'metadata.yaml'))
401 md = yaml.safe_load(mdf)
402 rel_types = []408 rel_types = []
409 md = metadata()
403 for key in ('provides', 'requires', 'peers'):410 for key in ('provides', 'requires', 'peers'):
404 section = md.get(key)411 section = md.get(key)
405 if section:412 if section:
406 rel_types.extend(section.keys())413 rel_types.extend(section.keys())
407 mdf.close()
408 return rel_types414 return rel_types
409415
410416
411@cached417@cached
418def charm_name():
419 """Get the name of the current charm as is specified on metadata.yaml"""
420 return metadata().get('name')
421
422
423@cached
412def relations():424def relations():
413 """Get a nested dictionary of relation data for all related units"""425 """Get a nested dictionary of relation data for all related units"""
414 rels = {}426 rels = {}
415427
=== modified file 'hooks/charmhelpers/core/host.py'
--- hooks/charmhelpers/core/host.py 2014-11-25 17:07:46 +0000
+++ hooks/charmhelpers/core/host.py 2014-12-11 17:56:06 +0000
@@ -101,6 +101,26 @@
101 return user_info101 return user_info
102102
103103
104def add_group(group_name, system_group=False):
105 """Add a group to the system"""
106 try:
107 group_info = grp.getgrnam(group_name)
108 log('group {0} already exists!'.format(group_name))
109 except KeyError:
110 log('creating group {0}'.format(group_name))
111 cmd = ['addgroup']
112 if system_group:
113 cmd.append('--system')
114 else:
115 cmd.extend([
116 '--group',
117 ])
118 cmd.append(group_name)
119 subprocess.check_call(cmd)
120 group_info = grp.getgrnam(group_name)
121 return group_info
122
123
104def add_user_to_group(username, group):124def add_user_to_group(username, group):
105 """Add a user to a group"""125 """Add a user to a group"""
106 cmd = [126 cmd = [
@@ -368,8 +388,8 @@
368388
369 '''389 '''
370 import apt_pkg390 import apt_pkg
371 from charmhelpers.fetch import apt_cache
372 if not pkgcache:391 if not pkgcache:
392 from charmhelpers.fetch import apt_cache
373 pkgcache = apt_cache()393 pkgcache = apt_cache()
374 pkg = pkgcache[package]394 pkg = pkgcache[package]
375 return apt_pkg.version_compare(pkg.current_ver.ver_str, revno)395 return apt_pkg.version_compare(pkg.current_ver.ver_str, revno)
376396
=== modified file 'hooks/charmhelpers/fetch/giturl.py'
--- hooks/charmhelpers/fetch/giturl.py 2014-11-25 17:04:02 +0000
+++ hooks/charmhelpers/fetch/giturl.py 2014-12-11 17:56:06 +0000
@@ -34,11 +34,14 @@
34 repo = Repo.clone_from(source, dest)34 repo = Repo.clone_from(source, dest)
35 repo.git.checkout(branch)35 repo.git.checkout(branch)
3636
37 def install(self, source, branch="master"):37 def install(self, source, branch="master", dest=None):
38 url_parts = self.parse_url(source)38 url_parts = self.parse_url(source)
39 branch_name = url_parts.path.strip("/").split("/")[-1]39 branch_name = url_parts.path.strip("/").split("/")[-1]
40 dest_dir = os.path.join(os.environ.get('CHARM_DIR'), "fetched",40 if dest:
41 branch_name)41 dest_dir = os.path.join(dest, branch_name)
42 else:
43 dest_dir = os.path.join(os.environ.get('CHARM_DIR'), "fetched",
44 branch_name)
42 if not os.path.exists(dest_dir):45 if not os.path.exists(dest_dir):
43 mkdir(dest_dir, perms=0o755)46 mkdir(dest_dir, perms=0o755)
44 try:47 try:
4548
=== modified file 'tests/charmhelpers/__init__.py'
--- tests/charmhelpers/__init__.py 2014-08-25 18:42:17 +0000
+++ tests/charmhelpers/__init__.py 2014-12-11 17:56:06 +0000
@@ -0,0 +1,22 @@
1# Bootstrap charm-helpers, installing its dependencies if necessary using
2# only standard libraries.
3import subprocess
4import sys
5
6try:
7 import six # flake8: noqa
8except ImportError:
9 if sys.version_info.major == 2:
10 subprocess.check_call(['apt-get', 'install', '-y', 'python-six'])
11 else:
12 subprocess.check_call(['apt-get', 'install', '-y', 'python3-six'])
13 import six # flake8: noqa
14
15try:
16 import yaml # flake8: noqa
17except ImportError:
18 if sys.version_info.major == 2:
19 subprocess.check_call(['apt-get', 'install', '-y', 'python-yaml'])
20 else:
21 subprocess.check_call(['apt-get', 'install', '-y', 'python3-yaml'])
22 import yaml # flake8: noqa

Subscribers

People subscribed via source and target branches