Bug 696681 - Problem when using special characters in server name field
Summary: Problem when using special characters in server name field
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: spacecmd
Version: el5
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Aron Parsons
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: space15
TreeView+ depends on / blocked
 
Reported: 2011-04-14 15:46 UTC by William Lovins
Modified: 2016-01-04 05:14 UTC (History)
2 users (show)

Fixed In Version: spacecmd-1.5.1-1
Clone Of:
Environment:
Last Closed: 2011-04-18 18:59:46 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description William Lovins 2011-04-14 15:46:32 UTC
Description of problem:
or some servers in our environment, we change the system name field
in Spacewalk to include both the server name AND an easier to read
alias: "web-app-01 (cu1prod2app1)". We were using the api directly via
Frontier::RPC, but are attempting to switch to using spacecmd instead
so we don’t have to maintain the rpc portion of the code and so we
don’t have to modify it every time a new api method is added as the
maintainer is already doing that. Everything has been working until
today when we started testing using servers that include parenthesis
in the name field. This seems to either generate an error or to
silently fail, depending on the command used.

For example:

This command fails silently:
rm -rf /root/.spacecmd/
spacecmd -d -s spacewalk -u someuser -p somepass --
system_updatecustomvalue 'web-app-01 (cu1prod2app1)' is_web yes

This command fails with an error:
rm -rf /root/.spacecmd/
spacecmd -d -s spacewalk -u someuser -p somepass --
system_updatecustomvalue web-app-01(cu1prod2app1) is_web yes

The command also fails if there is a space in the system name field,
even if quotes are used. It seems that quoting the name field causes
the command to fail silently, even with debug turned on.

This seems to be a spacecmd issue as it didn’t occur when we used rpc.
I’m curious if this is a bug or an intended limitation.

Additionally, the command does work if we pass the sid and not the
name, but unfortunately, when using the group:GroupName switch to
iterate through all servers in a group, we get errors as spacecmd
seems to use the system name field and not the sid.

Lastly, it also appears that spacecmd does not like spaces in group
names, even if quotes are used.


Version-Release number of selected component (if applicable):
spacecmd-1.2.2
spacecmd-1.4.5

How reproducible:
Always

Steps to Reproduce:
1. See above
2.
3.
  
Actual results:
Fields don't update and output is incorrect.

Expected results:
Fields should update properly when working with a server where the name field is more than a single non-spaced word.

Additional info:

Comment 1 Aron Parsons 2011-04-18 18:59:46 UTC
Spaces and special characters are now handled properly within spacecmd.  This required an argument order change for system_addcustomvalue and system_updatecustomvalue due to a crappy way of handling arguments on my part before.

spacecmd {SSM:0}> system_updatecustomvalue is_web yes 'web-app-01 \(cu1prod2app1\)'           
spacecmd {SSM:0}> system_listcustomvalues 'web-app-01 \(cu1prod2app1\)'
is_web = yes
spacecmd {SSM:0}>

spacecmd {SSM:0}> group_listsystems 'space test'
web-app-01 (cu1prod2app1)
spacecmd {SSM:0}> system_listcustomvalues 'group:space test'
is_web = yes
spacecmd {SSM:0}> 

You have to escape any special characters in the hostnames.  This is because regular expressions are valid arguments as system names and the parentheses would be interpreted as part of the regex.  This is not a problem when doing 'group:' or 'channel:' arguments, that is handled correctly internally.

These changes are in spacecmd-1.5.1-1.

Comment 2 Miroslav Suchý 2011-04-19 06:32:11 UTC
Not current release, but future release. We have to build it and I'm going to do it when Spacewalk 1.5 will be released. Which is aprox 2-3 month ahead.


Note You need to log in before you can comment on or make changes to this bug.