saltstack / saltstack/salt

salt-cloud vmware list_nodes_min does a set for the VM power state instead of returning the actual power state

Open
#64,604 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage Salt-Cloud
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

list_nodes and list_nodes_full work as expected and return VM's correct power state. For list_nodes_min, it is statically set to "Running" even when it isn't. I believe it should return str(vm["summary.runtime.powerState"]) like the other state keys in list_nodes* if anything it shouldn't be statically set to Running either.

https://github.com/saltstack/salt/blob/51e9fb6e71fcb76e809222c68c4710dbf54135ac/salt/cloud/clouds/vmware.py#L1955C1-L1955C1

I believe it should be:

ret[vm["name"]] = {"state": str(vm["summary.runtime.powerState"]), "id": vm["name"]}

Thanks in advance!

Setup

Nothing to put in here, the code shows list_nodes_min is statically set.

Steps to Reproduce Issue

Pick one or the other.

# list_nodes - works
salt-cloud --out=json -f list_nodes THINGY | jq -r '.[][] | to_entries[] | select(.value.state != "poweredOff")'

# list_nodes_full - works
salt-cloud --out=json -f list_nodes_full THINGY | jq -r '.[][] | to_entries[] | select(.value.state != "poweredOff")'

# list_nodes_min - doesn't work
salt-cloud --out=json -f list_nodes_min THINGY | jq -r '.[][] | to_entries[] | select(.value.state != "poweredOff")'
Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

          Salt: 3006.1
 
Python Version:
        Python: 3.10.11 (main, May  5 2023, 02:31:54) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.14.6
      cherrypy: unknown
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: Not Installed
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
  python-gnupg: 0.4.8
        PyYAML: 5.4.1
         PyZMQ: 23.2.0
        relenv: 0.12.3
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: ubuntu 20.04.6 focal
        locale: utf-8
       machine: x86_64
       release: 5.4.0-150-generic
        system: Linux
       version: Ubuntu 20.04.6 focal

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open salt/cloud/clouds/vmware.py at list_nodes_min and compare its state handling with list_nodes and list_nodes_full. Reproduce with the listed salt-cloud and jq commands, then verify that list_nodes_min reports each VM's actual power state, including poweredOff, rather than always reporting Running.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cloud
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.