Public bug reported:

Using "$ lxc <entity> unset <entity> <key>"

If a value is passed in after the key the config key will be set with
the value passed in.

"$ lxc <entity> unset <entity> <key> <value>" behaves as you would
expect "$ lxc <entity> set <entity> <key> <value>" to behave.

The cli parser does not complain about an incorrect number of
parameters.

Examples and OS/LXD version info below

ubuntu@FF00:~$ lxc network unset br1 bridge.external_interfaces enp7s0f0
ubuntu@FF00:~$ lxc network show br1
config:
  bridge.external_interfaces: enp7s0f0
  ipv4.address: 172.17.1.2/24
  ipv4.nat: "false"
  ipv6.address: none
name: br1
type: bridge
used_by:
- /1.0/containers/enabled-possum
managed: true

ubuntu@FF00:~$ lxc network unset br1 bridge.external_interfaces garbage
ubuntu@FF00:~$ lxc network show br1
config:
  bridge.external_interfaces: garbage
  ipv4.address: 172.17.1.2/24
  ipv4.nat: "false"
  ipv6.address: none
name: br1
type: bridge
used_by:
- /1.0/containers/enabled-possum
managed: true

ubuntu@FF00:~$ lxc network unset br1 bridge.external_interfaces
ubuntu@FF00:~$ lxc network show br1
config:
  ipv4.address: 172.17.1.2/24
  ipv4.nat: "false"
  ipv6.address: none
name: br1
type: bridge
used_by:
- /1.0/containers/enabled-possum
managed: true

ubuntu@FF00:~$ lxc profile set default limits.memory 10GB
ubuntu@FF00:~$ lxc profile show default
config:
  limits.memory: 10GB
description: Default LXD profile
devices:
  eth0:
    nictype: bridged
    parent: br1
    type: nic
  root:
    path: /
    pool: default
    type: disk
name: default
used_by:
- /1.0/containers/enabled-possum

ubuntu@FF00:~$ lxc profile unset default limits.memory 5GB
ubuntu@FF00:~$ lxc profile show default
config:
  limits.memory: 5GB
description: Default LXD profile
devices:
  eth0:
    nictype: bridged
    parent: br1
    type: nic
  root:
    path: /
    pool: default
    type: disk
name: default
used_by:
- /1.0/containers/enabled-possum

ubuntu@FF00:~$ lxc profile unset default limits.memory
ubuntu@FF00:~$ lxc profile show default
config: {}
description: Default LXD profile
devices:
  eth0:
    nictype: bridged
    parent: br1
    type: nic
  root:
    path: /
    pool: default
    type: disk
name: default
used_by:
- /1.0/containers/enabled-possum

ubuntu@FF00:~$ uname -a
Linux FF00 4.4.0-65-generic #86-Ubuntu SMP Thu Feb 23 17:49:58 UTC 2017 x86_64 
x86_64 x86_64 GNU/Linux

ubuntu@FF00:~$ lsb_release -rd
Description:  Ubuntu 16.04.2 LTS
Release:  16.04

ubuntu@FF00:~$ lxc version
2.10.1

ubuntu@FF00:~$ apt list --installed | grep lxd

lxd/xenial,now 2.10.1-0ubuntu1~ubuntu16.04.1~ppa1 amd64 [installed]
lxd-client/xenial,now 2.10.1-0ubuntu1~ubuntu16.04.1~ppa1 amd64 [installed]
lxd-tools/xenial,now 2.10.1-0ubuntu1~ubuntu16.04.1~ppa1 amd64 [installed]

** Affects: lxd (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  Using "$ lxc <entity> unset <entity> <key>"
  
- If a value is passed in after the key the config key will be set with the 
value passed in. ie 
- "$ lxc <entity> unset <entity> <key> <value>" behaves as you would expect "$ 
lxc <entity> set <entity> key value" to behave.
+ If a value is passed in after the key the config key will be set with
+ the value passed in.
+ 
+ "$ lxc <entity> unset <entity> <key> <value>" behaves as you would
+ expect "$ lxc <entity> set <entity> <key> <value>" to behave.
  
  The cli parser does not complain about an incorrect number of
  parameters.
  
  Examples and OS/LXD version info below
  
- 
  ubuntu@FF00:~$ lxc network unset br1 bridge.external_interfaces enp7s0f0
  ubuntu@FF00:~$ lxc network show br1
  config:
-   bridge.external_interfaces: enp7s0f0
-   ipv4.address: 172.17.1.2/24
-   ipv4.nat: "false"
-   ipv6.address: none
+   bridge.external_interfaces: enp7s0f0
+   ipv4.address: 172.17.1.2/24
+   ipv4.nat: "false"
+   ipv6.address: none
  name: br1
  type: bridge
  used_by:
  - /1.0/containers/enabled-possum
  managed: true
  
- 
  ubuntu@FF00:~$ lxc network unset br1 bridge.external_interfaces garbage
  ubuntu@FF00:~$ lxc network show br1
  config:
-   bridge.external_interfaces: garbage
-   ipv4.address: 172.17.1.2/24
-   ipv4.nat: "false"
-   ipv6.address: none
+   bridge.external_interfaces: garbage
+   ipv4.address: 172.17.1.2/24
+   ipv4.nat: "false"
+   ipv6.address: none
  name: br1
  type: bridge
  used_by:
  - /1.0/containers/enabled-possum
  managed: true
  
- 
  ubuntu@FF00:~$ lxc network unset br1 bridge.external_interfaces
  ubuntu@FF00:~$ lxc network show br1
  config:
-   ipv4.address: 172.17.1.2/24
-   ipv4.nat: "false"
-   ipv6.address: none
+   ipv4.address: 172.17.1.2/24
+   ipv4.nat: "false"
+   ipv6.address: none
  name: br1
  type: bridge
  used_by:
  - /1.0/containers/enabled-possum
  managed: true
  
- 
  ubuntu@FF00:~$ lxc profile set default limits.memory 10GB
- ubuntu@FF00:~$ lxc profile show default 
+ ubuntu@FF00:~$ lxc profile show default
  config:
-   limits.memory: 10GB
+   limits.memory: 10GB
  description: Default LXD profile
  devices:
-   eth0:
-     nictype: bridged
-     parent: br1
-     type: nic
-   root:
-     path: /
-     pool: default
-     type: disk
+   eth0:
+     nictype: bridged
+     parent: br1
+     type: nic
+   root:
+     path: /
+     pool: default
+     type: disk
  name: default
  used_by:
  - /1.0/containers/enabled-possum
  
- 
  ubuntu@FF00:~$ lxc profile unset default limits.memory 5GB
- ubuntu@FF00:~$ lxc profile show default 
+ ubuntu@FF00:~$ lxc profile show default
  config:
-   limits.memory: 5GB
+   limits.memory: 5GB
  description: Default LXD profile
  devices:
-   eth0:
-     nictype: bridged
-     parent: br1
-     type: nic
-   root:
-     path: /
-     pool: default
-     type: disk
+   eth0:
+     nictype: bridged
+     parent: br1
+     type: nic
+   root:
+     path: /
+     pool: default
+     type: disk
  name: default
  used_by:
  - /1.0/containers/enabled-possum
  
- 
  ubuntu@FF00:~$ lxc profile unset default limits.memory
- ubuntu@FF00:~$ lxc profile show default 
+ ubuntu@FF00:~$ lxc profile show default
  config: {}
  description: Default LXD profile
  devices:
-   eth0:
-     nictype: bridged
-     parent: br1
-     type: nic
-   root:
-     path: /
-     pool: default
-     type: disk
+   eth0:
+     nictype: bridged
+     parent: br1
+     type: nic
+   root:
+     path: /
+     pool: default
+     type: disk
  name: default
  used_by:
  - /1.0/containers/enabled-possum
- 
  
  ubuntu@FF00:~$ uname -a
  Linux FF00 4.4.0-65-generic #86-Ubuntu SMP Thu Feb 23 17:49:58 UTC 2017 
x86_64 x86_64 x86_64 GNU/Linux
  
  ubuntu@FF00:~$ lsb_release -rd
  Description:  Ubuntu 16.04.2 LTS
  Release:  16.04
  
  ubuntu@FF00:~$ lxc version
  2.10.1
  
  ubuntu@FF00:~$ apt list --installed | grep lxd
  
  lxd/xenial,now 2.10.1-0ubuntu1~ubuntu16.04.1~ppa1 amd64 [installed]
  lxd-client/xenial,now 2.10.1-0ubuntu1~ubuntu16.04.1~ppa1 amd64 [installed]
  lxd-tools/xenial,now 2.10.1-0ubuntu1~ubuntu16.04.1~ppa1 amd64 [installed]

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1669772

Title:
  lxc 'unset' can be used to set config key:value

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lxd/+bug/1669772/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to