launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25094
[Merge] ~cjwatson/lp-signing:charm-handle-missing-system-packages into lp-signing:master
Colin Watson has proposed merging ~cjwatson/lp-signing:charm-handle-missing-system-packages into lp-signing:master.
Commit message:
charm: Only link packages from system-packages.txt if it exists
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/lp-signing/+git/lp-signing/+merge/388193
Otherwise it's difficult to upgrade an existing environment, as the charm wouldn't tolerate the old code asset but the new code asset needs the new charm.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/lp-signing:charm-handle-missing-system-packages into lp-signing:master.
diff --git a/charm/lp-signing/reactive/lp-signing.py b/charm/lp-signing/reactive/lp-signing.py
index a563e26..23a594d 100644
--- a/charm/lp-signing/reactive/lp-signing.py
+++ b/charm/lp-signing/reactive/lp-signing.py
@@ -72,13 +72,15 @@ def configure(pgsql):
if pgsql.master is None:
return
- site_packages = subprocess.check_output(
- [os.path.join(base.code_dir(), 'env', 'bin', 'python'), '-c',
- 'from distutils.sysconfig import get_python_lib; '
- 'print(get_python_lib())'], universal_newlines=True).rstrip('\n')
- subprocess.check_call(
- [os.path.join(base.code_dir(), 'link-system-packages.py'),
- site_packages, os.path.join(base.code_dir(), 'system-packages.txt')])
+ system_packages = os.path.join(base.code_dir(), 'system-packages.txt')
+ if os.path.exists(system_packages):
+ site_packages = subprocess.check_output(
+ [os.path.join(base.code_dir(), 'env', 'bin', 'python'), '-c',
+ 'from distutils.sysconfig import get_python_lib; '
+ 'print(get_python_lib())'], universal_newlines=True).rstrip('\n')
+ subprocess.check_call(
+ [os.path.join(base.code_dir(), 'link-system-packages.py'),
+ site_packages, system_packages])
config = hookenv.config()
config_path = base.service_config_path()
Follow ups