summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Ames <david.ames@canonical.com>2019-02-12 15:55:47 -0800
committerChris MacNaughton <chris@centaurisolutions.nl>2019-02-13 07:59:33 +0100
commitd26fabe67474930dcae0a5f04a745b2092f9558d (patch)
treee2563d913108d42fe167664935f2901ec3c56f70
parent4d3c230336123d1090dc7bdf07eacae9559bc8d6 (diff)
Update charm-helpers-hooks.yaml and sync ch
Using the new version of the sync tool which removes the charmhelpers directory before syncing, run charm helpers sync to find any unexpected missing dependencies. Change-Id: Ifa5ba56af4b120903c2cc3822834c4279cd56acc
Notes
Notes (review): Verified+1: Canonical CI <uosci-testing-bot@ubuntu.com> Code-Review+1: David Ames <david.ames@canonical.com> Code-Review+2: Frode Nordahl <frode.nordahl@canonical.com> Workflow+1: Frode Nordahl <frode.nordahl@canonical.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 19 Feb 2019 16:05:54 +0000 Reviewed-on: https://review.openstack.org/636478 Project: openstack/charm-ceph-proxy Branch: refs/heads/master
-rw-r--r--hooks/charmhelpers/contrib/openstack/utils.py18
-rw-r--r--hooks/charmhelpers/contrib/python.py21
-rw-r--r--hooks/charmhelpers/contrib/storage/linux/ceph.py27
-rw-r--r--hooks/charmhelpers/core/host.py1
-rw-r--r--hooks/charmhelpers/core/host_factory/ubuntu.py8
-rw-r--r--hooks/charmhelpers/fetch/python/__init__.py (renamed from hooks/charmhelpers/contrib/python/__init__.py)2
-rw-r--r--hooks/charmhelpers/fetch/python/debug.py (renamed from hooks/charmhelpers/contrib/python/debug.py)2
-rw-r--r--hooks/charmhelpers/fetch/python/packages.py (renamed from hooks/charmhelpers/contrib/python/packages.py)0
-rw-r--r--hooks/charmhelpers/fetch/python/rpdb.py (renamed from hooks/charmhelpers/contrib/python/rpdb.py)0
-rw-r--r--hooks/charmhelpers/fetch/python/version.py (renamed from hooks/charmhelpers/contrib/python/version.py)0
10 files changed, 68 insertions, 11 deletions
diff --git a/hooks/charmhelpers/contrib/openstack/utils.py b/hooks/charmhelpers/contrib/openstack/utils.py
index 4e432a2..86b011b 100644
--- a/hooks/charmhelpers/contrib/openstack/utils.py
+++ b/hooks/charmhelpers/contrib/openstack/utils.py
@@ -83,7 +83,8 @@ from charmhelpers.fetch import (
83 add_source as fetch_add_source, 83 add_source as fetch_add_source,
84 SourceConfigError, 84 SourceConfigError,
85 GPGKeyError, 85 GPGKeyError,
86 get_upstream_version 86 get_upstream_version,
87 filter_missing_packages
87) 88)
88 89
89from charmhelpers.fetch.snap import ( 90from charmhelpers.fetch.snap import (
@@ -309,6 +310,15 @@ def error_out(msg):
309 sys.exit(1) 310 sys.exit(1)
310 311
311 312
313def get_installed_semantic_versioned_packages():
314 '''Get a list of installed packages which have OpenStack semantic versioning
315
316 :returns List of installed packages
317 :rtype: [pkg1, pkg2, ...]
318 '''
319 return filter_missing_packages(PACKAGE_CODENAMES.keys())
320
321
312def get_os_codename_install_source(src): 322def get_os_codename_install_source(src):
313 '''Derive OpenStack release codename from a given installation source.''' 323 '''Derive OpenStack release codename from a given installation source.'''
314 ubuntu_rel = lsb_release()['DISTRIB_CODENAME'] 324 ubuntu_rel = lsb_release()['DISTRIB_CODENAME']
@@ -972,7 +982,9 @@ def _ows_check_charm_func(state, message, charm_func_with_configs):
972 """ 982 """
973 if charm_func_with_configs: 983 if charm_func_with_configs:
974 charm_state, charm_message = charm_func_with_configs() 984 charm_state, charm_message = charm_func_with_configs()
975 if charm_state != 'active' and charm_state != 'unknown': 985 if (charm_state != 'active' and
986 charm_state != 'unknown' and
987 charm_state is not None):
976 state = workload_state_compare(state, charm_state) 988 state = workload_state_compare(state, charm_state)
977 if message: 989 if message:
978 charm_message = charm_message.replace("Incomplete relations: ", 990 charm_message = charm_message.replace("Incomplete relations: ",
@@ -1241,7 +1253,7 @@ def remote_restart(rel_name, remote_service=None):
1241 1253
1242 1254
1243def check_actually_paused(services=None, ports=None): 1255def check_actually_paused(services=None, ports=None):
1244 """Check that services listed in the services object and and ports 1256 """Check that services listed in the services object and ports
1245 are actually closed (not listened to), to verify that the unit is 1257 are actually closed (not listened to), to verify that the unit is
1246 properly paused. 1258 properly paused.
1247 1259
diff --git a/hooks/charmhelpers/contrib/python.py b/hooks/charmhelpers/contrib/python.py
new file mode 100644
index 0000000..84cba8c
--- /dev/null
+++ b/hooks/charmhelpers/contrib/python.py
@@ -0,0 +1,21 @@
1# Copyright 2014-2019 Canonical Limited.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15from __future__ import absolute_import
16
17# deprecated aliases for backwards compatibility
18from charmhelpers.fetch.python import debug # noqa
19from charmhelpers.fetch.python import packages # noqa
20from charmhelpers.fetch.python import rpdb # noqa
21from charmhelpers.fetch.python import version # noqa
diff --git a/hooks/charmhelpers/contrib/storage/linux/ceph.py b/hooks/charmhelpers/contrib/storage/linux/ceph.py
index 7682820..63c9304 100644
--- a/hooks/charmhelpers/contrib/storage/linux/ceph.py
+++ b/hooks/charmhelpers/contrib/storage/linux/ceph.py
@@ -856,12 +856,22 @@ def _keyring_path(service):
856 return KEYRING.format(service) 856 return KEYRING.format(service)
857 857
858 858
859def create_keyring(service, key): 859def add_key(service, key):
860 """Create a new Ceph keyring containing key.""" 860 """
861 Add a key to a keyring.
862
863 Creates the keyring if it doesn't already exist.
864
865 Logs and returns if the key is already in the keyring.
866 """
861 keyring = _keyring_path(service) 867 keyring = _keyring_path(service)
862 if os.path.exists(keyring): 868 if os.path.exists(keyring):
863 log('Ceph keyring exists at %s.' % keyring, level=WARNING) 869 with open(keyring, 'r') as ring:
864 return 870 if key in ring.read():
871 log('Ceph keyring exists at %s and has not changed.' % keyring,
872 level=DEBUG)
873 return
874 log('Updating existing keyring %s.' % keyring, level=DEBUG)
865 875
866 cmd = ['ceph-authtool', keyring, '--create-keyring', 876 cmd = ['ceph-authtool', keyring, '--create-keyring',
867 '--name=client.{}'.format(service), '--add-key={}'.format(key)] 877 '--name=client.{}'.format(service), '--add-key={}'.format(key)]
@@ -869,6 +879,11 @@ def create_keyring(service, key):
869 log('Created new ceph keyring at %s.' % keyring, level=DEBUG) 879 log('Created new ceph keyring at %s.' % keyring, level=DEBUG)
870 880
871 881
882def create_keyring(service, key):
883 """Deprecated. Please use the more accurately named 'add_key'"""
884 return add_key(service, key)
885
886
872def delete_keyring(service): 887def delete_keyring(service):
873 """Delete an existing Ceph keyring.""" 888 """Delete an existing Ceph keyring."""
874 keyring = _keyring_path(service) 889 keyring = _keyring_path(service)
@@ -905,7 +920,7 @@ def get_ceph_nodes(relation='ceph'):
905 920
906def configure(service, key, auth, use_syslog): 921def configure(service, key, auth, use_syslog):
907 """Perform basic configuration of Ceph.""" 922 """Perform basic configuration of Ceph."""
908 create_keyring(service, key) 923 add_key(service, key)
909 create_key_file(service, key) 924 create_key_file(service, key)
910 hosts = get_ceph_nodes() 925 hosts = get_ceph_nodes()
911 with open('/etc/ceph/ceph.conf', 'w') as ceph_conf: 926 with open('/etc/ceph/ceph.conf', 'w') as ceph_conf:
@@ -1068,7 +1083,7 @@ def ensure_ceph_keyring(service, user=None, group=None,
1068 if not key: 1083 if not key:
1069 return False 1084 return False
1070 1085
1071 create_keyring(service=service, key=key) 1086 add_key(service=service, key=key)
1072 keyring = _keyring_path(service) 1087 keyring = _keyring_path(service)
1073 if user and group: 1088 if user and group:
1074 check_call(['chown', '%s.%s' % (user, group), keyring]) 1089 check_call(['chown', '%s.%s' % (user, group), keyring])
diff --git a/hooks/charmhelpers/core/host.py b/hooks/charmhelpers/core/host.py
index 79953a4..47c1fc3 100644
--- a/hooks/charmhelpers/core/host.py
+++ b/hooks/charmhelpers/core/host.py
@@ -46,6 +46,7 @@ if __platform__ == "ubuntu":
46 lsb_release, 46 lsb_release,
47 cmp_pkgrevno, 47 cmp_pkgrevno,
48 CompareHostReleases, 48 CompareHostReleases,
49 get_distrib_codename,
49 ) # flake8: noqa -- ignore F401 for this import 50 ) # flake8: noqa -- ignore F401 for this import
50elif __platform__ == "centos": 51elif __platform__ == "centos":
51 from charmhelpers.core.host_factory.centos import ( # NOQA:F401 52 from charmhelpers.core.host_factory.centos import ( # NOQA:F401
diff --git a/hooks/charmhelpers/core/host_factory/ubuntu.py b/hooks/charmhelpers/core/host_factory/ubuntu.py
index a6d375a..d7e920e 100644
--- a/hooks/charmhelpers/core/host_factory/ubuntu.py
+++ b/hooks/charmhelpers/core/host_factory/ubuntu.py
@@ -72,6 +72,14 @@ def lsb_release():
72 return d 72 return d
73 73
74 74
75def get_distrib_codename():
76 """Return the codename of the distribution
77 :returns: The codename
78 :rtype: str
79 """
80 return lsb_release()['DISTRIB_CODENAME'].lower()
81
82
75def cmp_pkgrevno(package, revno, pkgcache=None): 83def cmp_pkgrevno(package, revno, pkgcache=None):
76 """Compare supplied revno with the revno of the installed package. 84 """Compare supplied revno with the revno of the installed package.
77 85
diff --git a/hooks/charmhelpers/contrib/python/__init__.py b/hooks/charmhelpers/fetch/python/__init__.py
index d7567b8..bff99dc 100644
--- a/hooks/charmhelpers/contrib/python/__init__.py
+++ b/hooks/charmhelpers/fetch/python/__init__.py
@@ -1,4 +1,4 @@
1# Copyright 2014-2015 Canonical Limited. 1# Copyright 2014-2019 Canonical Limited.
2# 2#
3# Licensed under the Apache License, Version 2.0 (the "License"); 3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License. 4# you may not use this file except in compliance with the License.
diff --git a/hooks/charmhelpers/contrib/python/debug.py b/hooks/charmhelpers/fetch/python/debug.py
index d2142c7..757135e 100644
--- a/hooks/charmhelpers/contrib/python/debug.py
+++ b/hooks/charmhelpers/fetch/python/debug.py
@@ -20,7 +20,7 @@ from __future__ import print_function
20import atexit 20import atexit
21import sys 21import sys
22 22
23from charmhelpers.contrib.python.rpdb import Rpdb 23from charmhelpers.fetch.python.rpdb import Rpdb
24from charmhelpers.core.hookenv import ( 24from charmhelpers.core.hookenv import (
25 open_port, 25 open_port,
26 close_port, 26 close_port,
diff --git a/hooks/charmhelpers/contrib/python/packages.py b/hooks/charmhelpers/fetch/python/packages.py
index 6e95028..6e95028 100644
--- a/hooks/charmhelpers/contrib/python/packages.py
+++ b/hooks/charmhelpers/fetch/python/packages.py
diff --git a/hooks/charmhelpers/contrib/python/rpdb.py b/hooks/charmhelpers/fetch/python/rpdb.py
index 9b31610..9b31610 100644
--- a/hooks/charmhelpers/contrib/python/rpdb.py
+++ b/hooks/charmhelpers/fetch/python/rpdb.py
diff --git a/hooks/charmhelpers/contrib/python/version.py b/hooks/charmhelpers/fetch/python/version.py
index 3eb4210..3eb4210 100644
--- a/hooks/charmhelpers/contrib/python/version.py
+++ b/hooks/charmhelpers/fetch/python/version.py