Project

General

Profile

Actions

Bug #20348

closed

Hammer Does Not Consistently Escape Quotes When Assigning JSON To A Host Parameter.

Added by Tomáš Strachota almost 7 years ago. Updated over 4 years ago.

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

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1466059

Description of problem:

When attempting to update a host, like so:

# hammer -u username host update --name testserver.example.com --parameters diskinfo2='[{"group": "apache", "pciid": 160, "fstype": "ext4", "mntopts": "", "owner": "root", "path": "/mount/point/1", "fmtopts": "", "scsiid": 1, "size": 75}, {"group": "apache", "pciid": 160, "fstype": "xfs", "mntopts": "", "owner": "apache", "path": "/mount/point/2", "fmtopts": "", "scsiid": 2, "size": 200}]'

...the host parameter "diskinfo2" is set to:

["{\"group\": \"apache", "pciid\": 160", "fstype\": \"ext4", "mntopts\": ", "owner\": \"root", "path\": \"/mount/point/1", "fmtopts\": ", "scsiid\": 1", "size\": 75}", "{\"group\": \"apache", "pciid\": 160", "fstype\": \"xfs", "mntopts\": ", "owner\": \"apache", "path\": \"/mount/point/2", "fmtopts\": ", "scsiid\": 2", "size\": 200}"]

(Note the inconsistently escaped quotes, like "size\" instead of \"size\".)

The issue is in 'KeyValueList' option normalizer that wrongly splits the key-value pairs.


Related issues 1 (0 open1 closed)

Related to Hammer CLI - Bug #26120: Insufficient parsing capabilities of complex list type optionsClosedOleh FedorenkoActions
Actions

Also available in: Atom PDF