openSUSE / salt

openSUSE and SUSE patches and backports for SaltStack
Apache License 2.0
22 stars 52 forks source link

Repair virt_query outputter #655

Open tacerus opened 4 months ago

tacerus commented 4 months ago

Upstream PR

https://github.com/saltstack/salt/pull/65843

What does this PR do?

What issues does this PR fix or reference?

Fixes: https://github.com/saltstack/salt/issues/65841

Previous Behavior

Outputter returns traceback.

New Behavior

Outputter returns pretty output:

# salt-run --out=virt_query virt.query host=squanchy.infra.opensuse.org
squanchy.infra.opensuse.org
  thor1.infra.opensuse.org
    CPU: 1
    Memory: 1000000
    State: running
    Disk - vdb:
      Size: 2541887488
      File: /data0/kvm/disks/thor1.infra.opensuse.org_root.qcow2
      File Format: qcow2
    NIC - fe:cd:47:19:e7:86:
      Source: x-os-thor
      Type: direct
# more VMs ...

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

^ I'm not sure about tests for this, some other outputters have tests in tests/pytests/unit/output/, but I'm not sure it's feasible for this one, it would need to hook into the virt module tests somehow to generate a VM fixture?

Commits signed with GPG?

Yes