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 #1

Updated by Dirk Mayer almost 9 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.

Actions #2

Updated by Dirk Mayer almost 9 years ago

bug can be closed

Actions #3

Updated by Dirk Mayer almost 9 years ago

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

Actions #4

Updated by Tomáš Strachota almost 9 years ago

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

Updated by Tomáš Strachota almost 9 years ago

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

Updated by Anonymous almost 9 years ago

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

Also available in: Atom PDF