[Spacewalk-list] Spacewalk 2.1 - characters in remote commands

Milan Zázrivec mzazrivec at redhat.com
Wed Apr 2 08:16:08 UTC 2014


On Tuesday 01 April 2014 21:09:31 BERGMAN Andrew wrote:
> Milan,
> 
> Thanks for confirming this is a bug not a lack of functionality.
> 
> I am not sure what I am supposed to do with that link to be honest
> 
> I am gathering that somewhere there is a call made when it schedules a
> command and I need to change that call to be another kind of call that
> works in 2.1?

Most of the stuff you can do in Spacewalk webui you are also able to achieve
with Spacewalk's XML-RPC API (i.e. you don't need your browser, but you're
able to write set of scripts which will automate whatever you'd otherwise
be doing manually clicking in webui).

So just as you're able to schedule a remote command in the webui, you're able
to do it with a xml-rpc script. Webui in Spacewalk 2.1 won't accept >< signs,
but xml-rpc api does (tested).

Some example scripts:

http://www.spacewalkproject.org/documentation/api/2.1/scripts.html

And in your particular case, the script you'd want (in python):

...
#!/usr/bin/python
import xmlrpclib

SATELLITE_URL = "http://your.spacewalk.url.com/rpc/api"
SATELLITE_LOGIN = "youruser"
SATELLITE_PASSWORD = "yourpassword"

system_id = 0 # change this to the system id you want to schedule the run for
user = "root"     # change this to the user to run the remote command as
groupt = "root"  # change this to the group to run the remote command as
timeout = 60 # in seconds
script = """
#!/bin/bash

echo "whatever" > /tmp/wherever
"""

client = xmlrpclib.Server(SATELLITE_URL, verbose=0)

key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD)
client.system.schedule_script_run(key,
    system_id, \
    user, \
    group, \
    timeout, \
    script, \
    xmlrpclib.DateTime())
client.auth.logout(key)
...

Regards
-MZ
> -----Original Message-----
> From: spacewalk-list-bounces at redhat.com
> [mailto:spacewalk-list-bounces at redhat.com] On Behalf Of Milan Zázrivec
> Sent: Tuesday, 1 April 2014 7:02 PM
> To: spacewalk-list at redhat.com
> Subject: Re: [Spacewalk-list] Spacewalk 2.1 - characters in remote commands
> 
> On Monday 31 March 2014 21:36:10 BERGMAN Andrew wrote:
> > Hi ,
> > 
> > I have done a bit of google searching but not had much luck finding an
> > answer so I am posting on here.
> > 
> > When sending a remote commands I am finding > characters getting
> > stripped out and making the command fail.  I haven't noticed any
> > others yet but I get the feeling that the > character will not be the only
> > one.
> You have just discovered a bug in Spacewalk 2.1 webui. This used to work
> just fine in Spacewalk 2.0.
> > Does anyone know a way of sending such characters using remote
> > commands or are we limited to very basic forms of commands?
> 
> Using > or < in the remote commands is all right. Right now though your only
> option is to use XML-RPC API and system.scheduleScriptRun() call:
> 
> http://www.spacewalkproject.org/documentation/api/2.1/handlers/SystemHandler
> .html#scheduleScriptRun
> 
> Regards
> -Milan Zázrivec
> 
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-list
> 
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
> 
> Disclaimer : The contents of this e-mail including any attachments are
> intended only for the person or entity to which this e-mail is addressed
> and may contain confidential, privileged and/or commercially sensitive
> material. If you are not, or believe you may not be, the intended
> recipient, please advise the sender immediately by return e-mail, delete
> this e-mail and destroy any copies.
> ______________________________________________________________________ This
> email has been scanned by the Symantec Email Security.cloud service. For
> more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
> 
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-list





More information about the Spacewalk-list mailing list