sandia-minimega / minimega

minimega
GNU General Public License v3.0
148 stars 67 forks source link

"clear vm tag" always clears all tags, even if a tag to clear is specified #1535

Closed GhostofGoes closed 3 months ago

GhostofGoes commented 4 months ago

Describe your environment

  1. minimega version: minimega 2.9 1a428a9c823445e7a5ddc79e29f27ef0231ca090 2024-01-04
  2. Linux distro/version: Ubuntu 20.04.6 LTS, Linux 5.15.0-94-generic
  3. Go compiler version: using the minimega docker image ghcr.io/sandia-minimega/minimega/minimega:master, sha cfbfcef162d1, created 2024-02-06T17:11:54
  4. VM types: Linux, Windows

Describe the bug The clear vm tag command will always clear all tags from a VM regardless of if only a specific tag should be cleared, e.g. clear vm tag myvm mytag.

To Reproduce

Note: mm in the examples below is just an alias to docker exec -it minimega minimega -e.

# Add some tags to the VM "load6"
$ mm vm tag load6 iperf3 yes
$ mm vm tag load6 iperf 1
$ mm vm tag load6 test yes

# List tags for VM "load6"
$ mm vm tag load6
host     | name  | tag    | value
harmonie | load6 | iperf  | 1
harmonie | load6 | iperf3 | yes
harmonie | load6 | test   | yes

# Attempt to clear the tag "iperf" from the VM "load6"
$ mm clear vm tag load6 iperf

# List tags for VM "load6". There are no tags listed, as all of the tags have been removed.
$ mm vm tag load6
... <nothing> ...

Expected behavior The expected behavior is only the tag specified should be cleared, and remaining tags should be left intact.