As a quick workaround hack you can use cloudinit-userdata. In my ~/.local/share/juju/clouds.yaml:
clouds:
...
lxd:
type: lxd
auth-types: [certificate]
endpoint: https://10.210.24.1:8443
config:
apt-http-proxy: http://192.168.0.50:3142
apt-https-proxy: http://192.168.0.50:3142
enable-os-upgrade: false
cloudinit-userdata: | preruncmd:
- "set -xe"
- "curl -s http://192.168.0.50/v2/auth/store/assertions | sudo snap ack /dev/stdin"
- "sudo snap set core proxy.store=yFsGTy6qwkrVISeJI1JjU09v9Uxlc0Gf"
snap-store-proxy: "yFsGTy6qwkrVISeJI1JjU09v9Uxlc0Gf"
snap-store-assertions: |
...
the "set -xe" isn't necessary, but it makes it possible to see that the next 2 commands are being run. When you use 'preruncmd' the values you set end up before *juju* calls 'set -xe' at the start of its normal runcmd. So while they are executed, without 'set -xe' you don't see them in /var/log/cloud-init-output.log.
As a quick workaround hack you can use cloudinit-userdata. In my ~/.local/ share/juju/ clouds. yaml: /10.210. 24.1:8443 http-proxy: http:// 192.168. 0.50:3142 https-proxy: http:// 192.168. 0.50:3142 os-upgrade: false -userdata: |
preruncmd: 192.168. 0.50/v2/ auth/store/ assertions | sudo snap ack /dev/stdin" yFsGTy6qwkrVISe JI1JjU09v9Uxlc0 Gf" store-proxy: "yFsGTy6qwkrVIS eJI1JjU09v9Uxlc 0Gf" store-assertion s: |
clouds:
...
lxd:
type: lxd
auth-types: [certificate]
endpoint: https:/
config:
apt-
apt-
enable-
cloudinit
- "set -xe"
- "curl -s http://
- "sudo snap set core proxy.store=
snap-
snap-
...
the "set -xe" isn't necessary, but it makes it possible to see that the next 2 commands are being run. When you use 'preruncmd' the values you set end up before *juju* calls 'set -xe' at the start of its normal runcmd. So while they are executed, without 'set -xe' you don't see them in /var/log/ cloud-init- output. log.