charm overrides snap-store-proxy setting

Bug #1905231 reported by Michał Ajduk
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Telegraf Charm
Won't Fix
Medium
Unassigned

Bug Description

This charm overwrites snap-store-proxy (the proxy ID) provided by juju model even when install method is deb. That breaks snap store proxy setup for other charms.

Root cause is https://bugs.launchpad.net/layer-snap/+bug/1882868

Reporting it here as after fixing the SNAP layer issue, this charm needs to be rebuilt.

Environment:

ubuntu@inf1az1cz202904rz:~$ juju model-config | grep snap
lxd-snap-channel default latest/stable
snap-http-proxy default ""
snap-https-proxy default ""
snap-store-assertions controller |-
snap-store-proxy controller ybyGkIokvRuSLPx5gR1ICivkACadQNK1
snap-store-proxy-url default ""

charm snap config:
  channel:
    default: stable
    description: The snap channel to install from.
    source: default
    type: string
    value: stable
  snap_proxy:
    default: ""
    description: |
      DEPRECATED. Use snap-http-proxy and snap-https-proxy model configuration settings. HTTP/HTTPS web proxy for Snappy to use when accessing the snap store.
    source: default
    type: string
    value: ""
  snap_proxy_url:
    default: ""
    description: |
      DEPRECATED. Use snap-store-proxy model configuration setting. The address of a Snap Store Proxy to use for snaps e.g. http://snap-proxy.example.com
    source: default
    type: string
    value: ""
  snapd_refresh:
    default: ""
    description: |
      How often snapd handles updates for installed snaps. The default (an empty string) is 4x per day. Set to "max" to check once per month based on the charm deployment date. You may also set a custom string as described in the 'refresh.timer' section here:
        https://forum.snapcraft.io/t/system-options/87
    source: default
    type: string
    value: ""

Steps to reproduce:
1. ubuntu@inf1az1cz202904rz:~$ juju add-machine vault-1
created machine 21

2. ubuntu@inf1az1cz202904rz:~$ juju ssh 21
root@vault-1:~# snap install core
2020-11-20T10:35:11Z INFO Waiting for automatic snapd restart...
core 16-2.47.1 from Canonical✓ installed

3. root@vault-1:~# snap get core proxy
Key Value
proxy.http
proxy.https
proxy.store ybyGkIokvRuSLPx5gR1ICivkACadQNK1

Up until this stage everything is fine and the OS is set uo use the snapstore.

4. juju add-unit telegraf --to 21
Juju logs:
2020-11-20 10:46:14 INFO juju-log Initializing Snap Layer

5. After this operation the proxy.store setting is removed:
root@vault-1:~# snap get core proxy
Key Value
proxy.http
proxy.https
proxy.store

Root cause is at snap.py:
def configure_snap_store_proxy():
    # Do nothing if we don't have kernel support yet
    if not kernel_supported():
        return

    if not reactive.is_flag_set('config.changed.snap_proxy_url'):
        return
    ensure_snapd_min_version('2.30')
    snap_store_proxy_url = hookenv.config()['snap_proxy_url']
    if snap_store_proxy_url:
        bundle, store_id = download_assertion_bundle(snap_store_proxy_url)
        try:
            subprocess.check_output(
                ['snap', 'ack', bundle],
                stdin=subprocess.DEVNULL,
                universal_newlines=True,
            )
        except subprocess.CalledProcessError as e:
            raise InvalidBundleError(
                'snapd could not ack the proxy assertion: ' + e.output)
    else:
        store_id = '' # THIS OVERWRITES THE STORE ID IF IT IS SET

Edin S (exsdev)
Changed in charm-telegraf:
importance: Undecided → Medium
Revision history for this message
Eric Chen (eric-chen) wrote :

This issue was pending long time. Is it still valid?
Furthermore, soon or later, the monitoring system will migrate to COS. Telegraf will be replaced by grafana-agent. Therefore, we won't follow up this issue. But welcome to reopen it when anyone encounter this issue again.
(https://charmhub.io/topics/canonical-observability-stack)

Changed in charm-telegraf:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.