Project

General

Profile

Actions

Bug #12869

closed

hammer fails with parameters that contains a commas

Added by Bryan Kearney about 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Category:
Hammer core
Target version:
-
Difficulty:
Triaged:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1292381
Description of problem:

hammer fails with parameters that contains a comma

Version-Release number of selected component (if applicable):
6.1.5

How reproducible:
100%

Steps to Reproduce:
Run a hammer command where a parameter contains a coma:

hammer --debug host create --subnet-id 3 --domain-id 2 --name testtest --organization-id 3 --location-id 2 --operatingsystem-id 1 --hostgroup-id 1 --mac AA:BB:CC:DD:EE:H1 --parameters bridges='"bridge0.20","bond0.20"],["bridge1","bond1"'

hammer --debug host create --subnet-id 3 --domain-id 2 --name testtest --organization-id 3 --location-id 2 --operatingsystem-id 1 --hostgroup-id 1 --mac AA:BB:CC:DD:EE:H1 --parameters bridges='a,b'

Actual results:

Clamp::UsageError (option '--parameters': value must be defined as a comma-separated list of key=value):
/usr/share/gems/gems/clamp-0.6.2/lib/clamp/option/parsing.rb:34:in `rescue in parse_options'
/usr/share/gems/gems/clamp-0.6.2/lib/clamp/option/parsing.rb:31:in `parse_options'
/usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:52:in `parse'
/usr/share/gems/gems/hammer_cli-0.1.4.13/lib/hammer_cli/abstract.rb:31:in `parse'
/usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:66:in `run'
/usr/share/gems/gems/hammer_cli-0.1.4.13/lib/hammer_cli/abstract.rb:23:in `run'
/usr/share/gems/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
/usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
/usr/share/gems/gems/hammer_cli-0.1.4.13/lib/hammer_cli/abstract.rb:23:in `run'
/usr/share/gems/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
/usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
/usr/share/gems/gems/hammer_cli-0.1.4.13/lib/hammer_cli/abstract.rb:23:in `run'
/usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run'
/usr/share/gems/gems/hammer_cli-0.1.4.13/bin/hammer:108:in `<top (required)>'
/usr/bin/hammer:23:in `load'
/usr/bin/hammer:23:in `<main>'

Expected results:
When the value of a key is between quotes, handle it as a string and ignore the commas.

Additional info:
Same parameters trough webui works and values are saved as string in db.

[#<HostParameter id: 46, name: "bridges", value: "\"bridge0.20\",\"bond0.20\"],[\"bridge1\",\"bond1\"", reference_id: 109, created_at: "2015-12-17 08:19:06", updated_at: "2015-12-17 08:19:06", type: "HostParameter", priority: 4, hidden_value: false>]

Actions

Also available in: Atom PDF