"juju config" with empty values erroneously resets since 2.9

Bug #1934151 reported by teluka
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Simon Richardson
NTP Charm
Invalid
Undecided
Unassigned

Bug Description

Unable to disable the default list of pool servers.

Juju versions:

~$ juju --version
2.9.5-ubuntu-amd64

~$ juju controllers
Controller Model User Access Cloud/Region Models Nodes HA Version
sts-stsstack* queens-xenial admin superuser sts/stsstack 2 16 none 2.9.5

Steps to reproduce:

~$ juju deploy ntp
Located charm "ntp" in charm-hub, revision 47
Deploying "ntp" from charm-hub charm "ntp", revision 47 in channel stable

~$ for i in source peers pools;do echo $i;juju config ntp $i;done;
source
peers
pools
0.ubuntu.pool.ntp.org 1.ubuntu.pool.ntp.org 2.ubuntu.pool.ntp.org 3.ubuntu.pool.ntp.org ntp.ubuntu.com

~$ juju config ntp source="" peers="" pools=""
WARNING the configuration setting "source" already has the value ""
WARNING the configuration setting "peers" already has the value ""

~$ for i in source peers pools;do echo $i;juju config ntp $i;done;
source
peers
pools
0.ubuntu.pool.ntp.org 1.ubuntu.pool.ntp.org 2.ubuntu.pool.ntp.org 3.ubuntu.pool.ntp.org ntp.ubuntu.com

~$ juju config ntp pools=""
~$ juju config ntp pools
0.ubuntu.pool.ntp.org 1.ubuntu.pool.ntp.org 2.ubuntu.pool.ntp.org 3.ubuntu.pool.ntp.org ntp.ubuntu.com

Workaround:

~$ cat >/tmp/ntp.override<<EOF
cat >/tmp/ntp.override<<EOF
applications:
  ntp:
    charm: cs:ntp-47
    channel: stable
    options:
      peers: "peers.ntp.internal 10.13.10.15"
      source: "10.12.11.10 10.12.17.11 10.12.17.12"
      pools: ""
EOF

~$ juju deploy /tmp/ntp.override
Located charm "ntp" in charm-store, revision 47
Executing changes:
- upload charm ntp from charm-store from channel stable with architecture=amd64
- upgrade ntp from charm-store using charm ntp from channel stable
- set application options for ntp
Deploy of bundle completed.

~$ for i in source peers pools;do echo $i;juju config ntp $i;done;
source
10.12.11.10 10.12.17.11 10.12.17.12
peers
peers.ntp.internal 10.13.10.15
pools

~$ juju config ntp pools

Revision history for this message
Junien F (axino) wrote :

Thanks for the bug report, but it feels to me that this is a juju controller problem, not a charm one. A charm cannot decide to accept a config change or not. As such, I'm marking this bug Invalid for the charm and adding Juju.

Changed in ntp-charm:
status: New → Invalid
summary: - Unable to disable the default list of pool servers
+ juju doesn't accept a config changed
summary: - juju doesn't accept a config changed
+ juju doesn't accept a config change
Revision history for this message
Junien F (axino) wrote : Re: juju doesn't accept a config change

Providing logs of the juju controller(s) would probably be helpful here. Thanks !

Revision history for this message
William Grant (wgrant) wrote :

It's a regression between Juju 2.8.11 and 2.9.5 when setting a config value to the empty string (plus possibly other values, e.g. " " does the same thing).

2.8.11:

  """
  ubuntu@juju-2-8:~$ cat bundle.yaml
  applications:
    haproxy:
      charm: cs:haproxy
      channel: stable
      options:
        services: ""
  ubuntu@juju-2-8:~$ juju deploy ./bundle.yaml
  Resolving charm: cs:haproxy from channel: stable
  Executing changes:
  - upload charm cs:haproxy-61 from channel stable
  - deploy application haproxy using cs:haproxy-61
  Deploy of bundle completed.
  ubuntu@juju-2-8:~$ ^C
  ubuntu@juju-2-8:~$ juju config haproxy services

  ubuntu@juju-2-8:~$ juju config haproxy services=""
  WARNING the configuration setting "services" already has the value ""
  ubuntu@juju-2-8:~$ juju config haproxy services

  ubuntu@juju-2-8:~$
  """

2.9.5:

  """
  ubuntu@juju-2-9:~$ cat bundle.yaml
  applications:
    haproxy:
      charm: cs:haproxy
      channel: stable
      options:
        services: ""
  ubuntu@juju-2-9:~$ juju deploy ./bundle.yaml
  Located charm "haproxy" in charm-store, channel stable
  Executing changes:
  - upload charm haproxy from charm-store from channel stable with architecture=amd64
  - deploy application haproxy from charm-store with stable
  Deploy of bundle completed.
  ubuntu@juju-2-9:~$ juju config haproxy services

  ubuntu@juju-2-9:~$ juju config haproxy services=""
  WARNING the configuration setting "services" already has the value ""
  ubuntu@juju-2-9:~$ juju config haproxy services
  - service_name: haproxy_service
    service_host: "0.0.0.0"
    service_port: 80
    service_options: [balance leastconn, cookie SRVNAME insert]
    server_options: maxconn 100 cookie S{i} check

  ubuntu@juju-2-9:~$
  """

Changed in juju:
status: New → Confirmed
Haw Loeung (hloeung)
tags: added: canonical-is canonical-is-upgrades
William Grant (wgrant)
summary: - juju doesn't accept a config change
+ "juju config" with empty values erroneously resets since 2.9
Changed in juju:
assignee: nobody → Simon Richardson (simonrichardson)
milestone: none → 2.9.8
importance: Undecided → High
Revision history for this message
Simon Richardson (simonrichardson) wrote :

I've located the issue and it's on all 2.9.x versions.

SetConfigs in the APIServer expects that every value in the config map has a value and to unset a value (services="") should call another method UnsetApplicationsConfig.

I need to work out the appropriate fix for this, ideally on the server so it fixes any 2.9.x client at the same time.

Revision history for this message
John A Meinel (jameinel) wrote :

services="" is meant to set services to the empty string, not meant to reset it. there is --reset services, to set services to the default value.

We had a very old API that had the old behavior (with early versions of Juju ~2.0), which is why we introduced some new methods which were very ugly named, which was our motivation for versioning facades in the first place.

It sounds like we somehow regressed to using the old method with the old interactions?

Revision history for this message
Simon Richardson (simonrichardson) wrote :

The workaround, for now, is to use config.yaml

```
haproxy:
  services: ""
```

$ juju config haproxy --file=./config.yaml

John A Meinel (jameinel)
Changed in juju:
status: Confirmed → Triaged
status: Triaged → In Progress
Revision history for this message
Simon Richardson (simonrichardson) wrote :
Changed in juju:
status: In Progress → Fix Committed
Ian Booth (wallyworld)
Changed in juju:
status: Fix Committed → Fix Released
John A Meinel (jameinel)
Changed in juju:
milestone: 2.9.8 → 2.9.7
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.