Comment 9 for bug 1883656

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :

Synced with jamespage on that and he suggested an alternative approach, since we already interact with juju via `juju-run` from the script that gets executed via a cron job, we could steal proxy settings from the `juju-run` environment.

https://opendev.org/openstack/charm-glance-simplestreams-sync/src/branch/stable/20.05/files/glance-simplestreams-sync.py#L373

I checked that proxy settings are available from the unit context in a juju-run invocation:

$ sudo juju-run <unit-name> env | grep _PROXY
JUJU_CHARM_FTP_PROXY=
JUJU_CHARM_HTTPS_PROXY=
JUJU_CHARM_HTTP_PROXY=
JUJU_CHARM_NO_PROXY=10.0.0.0/8,192.168.0.0/16,172.16.0.0/12

This allows us to query proxy settings dynamically and have the latest in-agent version at the time of the sync script invocation - this means we don't have to wait until proxy settings change notifications appear in Juju to fix this or do a subjective change to juju to write to /etc/juju-proxy.conf.