Project

General

Profile

Bug #12869

hammer fails with parameters that contains a commas

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

Status:
Closed
Priority:
Normal
Category:
Hammer core
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
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>]

Associated revisions

Revision 1c83d898 (diff)
Added by Tomas Strachota almost 5 years ago

Fixes #12869 - enable json for key=value parameters

Revision 8d08bc4e
Added by Martin Bacovsky almost 5 years ago

Merge pull request #197 from tstrachota/json_params_12869

Fixes #12869 - enable json for key=value parameters

History

#1 Updated by Dirk Mayer almost 5 years ago

After further investigation it became obvious that the problem came from a foreman hook which executed withe an error.
There was a from package installed. Withe the change to foreman 1.10 the rubygem rpm packages changed.
Instead of rubygem-jgrep the package tfm-rubygem-jgrep is now necessary to execute the hooks successful, and therefore also the hammer command.

#2 Updated by Dirk Mayer almost 5 years ago

bug can be closed

#3 Updated by Dirk Mayer almost 5 years ago

Sorry, comment was meant to be for another bug. please ignore my comments :(

#4 Updated by Tomáš Strachota almost 5 years ago

  • Category set to Hammer core
  • Status changed from New to Assigned
  • Assignee set to Tomáš Strachota

#5 Updated by Tomáš Strachota almost 5 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli/pull/197 added

#6 Updated by Anonymous almost 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF