c-h sync - restore proxy env vars for add-apt-repository
Change-Id: I0bae8222c687e45cb2ffa72e01f35b07ee137f7c Co-authored-by: Aurelien Lourot <aurelien.lourot@canonical.com>
This commit is contained in:
parent
be72b2d7df
commit
f8cb667d7d
|
@ -46,9 +46,13 @@ class ServiceEvent():
|
||||||
self.service = service
|
self.service = service
|
||||||
self.reason = reason
|
self.reason = reason
|
||||||
self.action = action
|
self.action = action
|
||||||
if not policy_requestor_name:
|
if policy_requestor_name:
|
||||||
|
self.policy_requestor_name = policy_requestor_name
|
||||||
|
else:
|
||||||
self.policy_requestor_name = hookenv.service_name()
|
self.policy_requestor_name = hookenv.service_name()
|
||||||
if not policy_requestor_type:
|
if policy_requestor_type:
|
||||||
|
self.policy_requestor_type = policy_requestor_type
|
||||||
|
else:
|
||||||
self.policy_requestor_type = 'charm'
|
self.policy_requestor_type = 'charm'
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
|
@ -99,7 +103,9 @@ def read_event_file(file_name):
|
||||||
contents['timestamp'],
|
contents['timestamp'],
|
||||||
contents['service'],
|
contents['service'],
|
||||||
contents['reason'],
|
contents['reason'],
|
||||||
contents['action'])
|
contents['action'],
|
||||||
|
policy_requestor_name=contents.get('policy_requestor_name'),
|
||||||
|
policy_requestor_type=contents.get('policy_requestor_type'))
|
||||||
return event
|
return event
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ from charmhelpers.core.hookenv import (
|
||||||
relation_id,
|
relation_id,
|
||||||
relation_ids,
|
relation_ids,
|
||||||
relation_set,
|
relation_set,
|
||||||
|
service_name as ch_service_name,
|
||||||
status_set,
|
status_set,
|
||||||
hook_name,
|
hook_name,
|
||||||
application_version_set,
|
application_version_set,
|
||||||
|
@ -1089,8 +1090,12 @@ def _determine_os_workload_status(
|
||||||
try:
|
try:
|
||||||
if config(POLICYD_CONFIG_NAME):
|
if config(POLICYD_CONFIG_NAME):
|
||||||
message = "{} {}".format(policyd_status_message_prefix(), message)
|
message = "{} {}".format(policyd_status_message_prefix(), message)
|
||||||
|
# Get deferred restarts events that have been triggered by a policy
|
||||||
|
# written by this charm.
|
||||||
deferred_restarts = list(set(
|
deferred_restarts = list(set(
|
||||||
[e.service for e in deferred_events.get_deferred_restarts()]))
|
[e.service
|
||||||
|
for e in deferred_events.get_deferred_restarts()
|
||||||
|
if e.policy_requestor_name == ch_service_name()]))
|
||||||
if deferred_restarts:
|
if deferred_restarts:
|
||||||
svc_msg = "Services queued for restart: {}".format(
|
svc_msg = "Services queued for restart: {}".format(
|
||||||
', '.join(sorted(deferred_restarts)))
|
', '.join(sorted(deferred_restarts)))
|
||||||
|
|
|
@ -658,17 +658,11 @@ def _add_apt_repository(spec):
|
||||||
:param spec: the parameter to pass to add_apt_repository
|
:param spec: the parameter to pass to add_apt_repository
|
||||||
:type spec: str
|
:type spec: str
|
||||||
"""
|
"""
|
||||||
series = get_distrib_codename()
|
|
||||||
if '{series}' in spec:
|
if '{series}' in spec:
|
||||||
|
series = get_distrib_codename()
|
||||||
spec = spec.replace('{series}', series)
|
spec = spec.replace('{series}', series)
|
||||||
# software-properties package for bionic properly reacts to proxy settings
|
_run_with_retries(['add-apt-repository', '--yes', spec],
|
||||||
# set via apt.conf (see lp:1433761), however this is not the case for LTS
|
cmd_env=env_proxy_settings(['https', 'http']))
|
||||||
# and non-LTS releases before bionic.
|
|
||||||
if series in ('trusty', 'xenial'):
|
|
||||||
_run_with_retries(['add-apt-repository', '--yes', spec],
|
|
||||||
cmd_env=env_proxy_settings(['https', 'http']))
|
|
||||||
else:
|
|
||||||
_run_with_retries(['add-apt-repository', '--yes', spec])
|
|
||||||
|
|
||||||
|
|
||||||
def _add_cloud_pocket(pocket):
|
def _add_cloud_pocket(pocket):
|
||||||
|
|
12
osci.yaml
12
osci.yaml
|
@ -1,9 +1,19 @@
|
||||||
- project:
|
- project:
|
||||||
templates:
|
templates:
|
||||||
- charm-unit-jobs
|
- charm-unit-jobs
|
||||||
- charm-functional-jobs
|
|
||||||
check:
|
check:
|
||||||
jobs:
|
jobs:
|
||||||
|
# NOTE(lourot): overriding zOSCI's default list because Wallaby+ bundles
|
||||||
|
# don't exist yet in this branch of the charm.
|
||||||
|
- xenial-mitaka
|
||||||
|
- bionic-queens
|
||||||
|
- bionic-stein
|
||||||
|
- bionic-train
|
||||||
|
- bionic-ussuri
|
||||||
|
- focal-ussuri
|
||||||
|
- focal-victoria
|
||||||
|
- groovy-victoria
|
||||||
|
|
||||||
- focal-ussuri-volume-only
|
- focal-ussuri-volume-only
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
|
|
Loading…
Reference in New Issue