8000 CLI: Unable to set values other than strings · Issue #2722 · cobbler/cobbler · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

CLI: Unable to set values other than strings #2722

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nodeg opened this issue Jul 29, 2021 · 2 comments · Fixed by #2727 or #2733
Closed

CLI: Unable to set values other than strings #2722

nodeg opened this issue Jul 29, 2021 · 2 comments · Fixed by #2727 or #2733
Assignees
Labels
Bug Report Reporting a bug main Not a release but referring to the Git main branch Priority Issues that will be worked on with higher priority. Usability
Milestone

Comments

@nodeg
Copy link
Member
nodeg commented Jul 29, 2021

Describe the bug

At the moment it is not posibble to set anything other than a string via the CLI.

Steps to reproduce

  1. Create a distro and a profile
  2. Create a system
  3. Try to set e.g. the Baud rate or the # of virt CPUs of the system
❯ cobbler system add --name stest2 --profile ptest --serial-baud-rate=240 
Usage: cobbler [options]

cobbler: error: option --serial-baud-rate: invalid choice: '240' (choose from '', '2400', '4800', '9600', '19200', '38400', '57600', '115200')

❯ cobbler system add --name stest2 --profile ptest --serial-baud-rate=2400
exception on server: serial baud rate needs to be of type int or enums.BaudRates

❯ cobbler system add --name stest2 --profile ptest --virt-cpus=1            
exception on server: virt_cpus needs to be an integer

Expected behavior

All values should be settable via the CLI.

Cobbler version

Current master branch.

$ cobbler version
 source: ab950916, Mon Jul 26 17:27:06 2021 +0200
  build time: Wed Jul 28 09:19:45 2021

Operating system

openSUSE Tumbleweed, SLES 15-SP3

Cobbler log

(...)
[Thread-173] 2021-07-29T09:44:33 - INFO | Exception occurred: <class 'TypeError'>
[Thread-173] 2021-07-29T09:44:33 - INFO | Exception value: serial baud rate needs to be of type int or enums.BaudRates
[Thread-173] 2021-07-29T09:44:33 - INFO | Exception Info:
  File "/usr/local/lib/python3.8/site-packages/cobbler/remote.py", line 3514, in _dispatch
    return method_handle(*params)

  File "/usr/local/lib/python3.8/site-packages/cobbler/remote.py", line 1942, in xapi_object_edit
    self.modify_item(object_type, handle, key, value, token)

  File "/usr/local/lib/python3.8/site-packages/cobbler/remote.py", line 1696, in modify_item
    setattr(obj, attribute, arg)

  File "/usr/local/lib/python3.8/site-packages/cobbler/items/system.py", line 1760, in serial_baud_rate
    self._serial_baud_rate = validate.validate_serial_baud_rate(baud_rate)

  File "/usr/local/lib/python3.8/site-packages/cobbler/validate.py", line 530, in validate_serial_baud_rate
    raise TypeError("serial baud rate needs to be of type int or enums.BaudRates")
(...)
[Thread-193] 2021-07-29T09:49:02 - INFO | Exception occurred: <class 'TypeError'>
[Thread-193] 2021-07-29T09:49:02 - INFO | Exception value: virt_cpus needs to be an integer
[Thread-193] 2021-07-29T09:49:02 - INFO | Exception Info:
  File "/usr/local/lib/python3.8/site-packages/cobbler/remote.py", line 3514, in _dispatch
    return method_handle(*params)

  File "/usr/local/lib/python3.8/site-packages/cobbler/remote.py", line 1942, in xapi_object
8000
_edit
    self.modify_item(object_type, handle, key, value, token)

  File "/usr/local/lib/python3.8/site-packages/cobbler/remote.py", line 1696, in modify_item
    setattr(obj, attribute, arg)

  File "/usr/local/lib/python3.8/site-packages/cobbler/items/system.py", line 1380, in virt_cpus
    self._virt_cpus = validate.validate_virt_cpus(num)

  File "/usr/local/lib/python3.8/site-packages/cobbler/validate.py", line 497, in validate_virt_cpus
    raise TypeError("virt_cpus needs to be an integer")
@nodeg nodeg added Usability Bug Report Reporting a bug Priority Issues that will be worked on with higher priority. API main Not a release but referring to the Git main branch labels Jul 29, 2021
@SchoolGuy SchoolGuy added this to the v3.3.0 milestone Jul 29, 2021
@nodeg nodeg self-assigned this Jul 29, 2021
nodeg added a commit that referenced this issue Jul 30, 2021
This PR partially (for ints/floats) fixes #2722.

Signed-off-by: Dominik Gedon <dgedon@suse.de>
nodeg added a commit that referenced this issue Jul 30, 2021
This PR partially (for ints/floats) fixes #2722.

Signed-off-by: Dominik Gedon <dgedon@suse.de>
@nodeg
Copy link
Member Author
nodeg commented Jul 30, 2021

TODO:

  • fix the problem for enums like the Baud rate from above.

nodeg added a commit that referenced this issue Jul 30, 2021
This PR partially (for ints/floats) fixes #2722.

Signed-off-by: Dominik Gedon <dgedon@suse.de>
nodeg added a commit that referenced this issue Jul 30, 2021
This PR partially (for ints/floats) fixes #2722.

Signed-off-by: Dominik Gedon <dgedon@suse.de>
nodeg added a commit that referenced this issue Jul 30, 2021
This PR partially (for ints/floats) fixes #2722.

Signed-off-by: Dominik Gedon <dgedon@suse.de>
@SchoolGuy
Copy link
Member

Reopen because only partly fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report Reporting a bug main Not a release but referring to the Git main branch Priority Issues that will be worked on with higher priority. Usability
Projects
None yet
2 participants
0