hetzner.hcloud icon indicating copy to clipboard operation
hetzner.hcloud copied to clipboard

hcloud_server_info.backup_window return value is a string containing "None" when not set

Open fin-ger opened this issue 2 years ago • 0 comments

SUMMARY

When running hcloud_server_info, the returned result contains the following when no backup is configured:

{
  ...
  "backup_window": "None",
  ...
}
ISSUE TYPE
  • Bug Report
COMPONENT NAME

hcloud_server_info

ANSIBLE VERSION
$ ansible --version
ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/finchristensen/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.10.5 (main, Jun  9 2022, 00:00:00) [GCC 11.3.1 20220421 (Red Hat 11.3.1-2)]
COLLECTION VERSION
$ ansible-galaxy collection list hetzner.hcloud
usage: ansible-galaxy collection [-h] COLLECTION_ACTION ...
ansible-galaxy collection: error: argument COLLECTION_ACTION: invalid choice: 'list' (choose from 'init', 'build', 'publish', 'install')

The command does not work and I could not figure out what the correct one would be. I will provide the information if you tell me how I can gather it.

CONFIGURATION
<empty>
OS / ENVIRONMENT
$ neofetch --stdout
***
------------------------------- 
OS: Fedora Linux 35 (Workstation Edition) x86_64 
Host: 20X300G1GE ThinkPad L15 Gen 2 
Kernel: 5.18.11-100.fc35.x86_64 
Uptime: ***
Packages: 2133 (rpm), 45 (flatpak) 
Shell: zsh 5.8.1 
Resolution: 2560x1440 
DE: GNOME 41.7 
WM: Mutter 
WM Theme: Adwaita 
Theme: Adwaita [GTK2/3] 
Icons: Adwaita [GTK2/3] 
Terminal: tilix 
CPU: 11th Gen Intel i7-1165G7 (8) @ 4.700GHz 
GPU: Intel TigerLake-LP GT2 [Iris Xe Graphics] 
Memory: 5887MiB / 31660MiB 
STEPS TO REPRODUCE

Run the hcloud_server_info module on a server without backups configured and look at the output.

- name: Create servers
  delegate_to: localhost
  hcloud_server:
    api_token: ...
    name: broken-backup-value-test
    server_type: cpx11
    image: debian-11
    location: nbg1
    backups: false
    state: started
- name: Fetch info on server
  delegate_to: localhost
  hcloud_server_info:
    api_token: ...
  register: result
EXPECTED RESULTS
result => [
  {
    "backup_window": null,
    "datacenter": "nbg1-dc3",
    "id": "...",
    "image": "debian-11",
    "ipv4_address": "...",
    "ipv6": "...",
    "labels": {},
    "location": "nbg1",
    "name": "broken-backup-value-test",
    "rescue_enabled": false,
    "server_type": "cpx11",
    "status": "running"
  }
]
ACTUAL RESULTS
result => [
  {
    "backup_window": "None",
    "datacenter": "nbg1-dc3",
    "id": "...",
    "image": "debian-11",
    "ipv4_address": "...",
    "ipv6": "...",
    "labels": {},
    "location": "nbg1",
    "name": "broken-backup-value-test",
    "rescue_enabled": false,
    "server_type": "cpx11",
    "status": "running"
  }
]

fin-ger avatar Jul 26 '22 09:07 fin-ger