Satellite API Question

Latest response

Hello all,

 

I am trying to write a python script for Satellite's API that will schedule a remote command. The problem is that even though I schedule the command to run now Satellite schedules 2 hours later. Here is my code:

def schedule_script

    earliest_occurrence = xmlrpclib.DateTime()

    print earliest_occurrence

    client.system.scheduleScriptRun(key, id, "root", "root", 300, script, earliest_occurrence)
 
schedule_script()
client.auth.logout(key)
 
 
When I screen print the variable "earliest_occurrence" it returns the correct time but for some reason Satellite will schedule the command exactly 2 hours from that time (current time). Has anyone ran into this issue? (also I verified that the Satellite server has the right time as well)
 
Any help would be greatly appreciated. Thanks!
 

Responses

Are you running UTC, or some offset?

Thanks for the reply!

I'm not entirely sure I understand. I am using xmlrpclib.DateTime() to get the current time (I don't know what that method is subject to or how it gets the time). The machine I'm running the script from and the Satellite server itself are both in EST. I have a feeling that the issue is coming from the configuration of one of the servers. We have RHEL servers in two location, Pheonix and Florida. Satellite is off-setting the time by scheduling the command 2 hours later than I want. This happens to be the time difference between Pheonix and Florida but I don't know wether Satellite is doing it or if the OS is doing it. Also, like I said above, if I screen print the variable "earliest_occurrence" (which is the time pulled by xmlrpclib.DateTime() ) it prints the correct EST. It seems the time change occurs once the command is sent to Satellite.

Thanks in advance!

Check the "Locale Preferences"  / TimeZone of the user account that you are using to obtain an API session key.  Is it also set to EST?  If not then I think you'll need to re-encode your ISO8601 datetime with an offest.

My account as well as the account my script is authenticating with are both set to GMT-0500 United States (Eastern). I am in Florida so this appears to be correct.

So I don't want to speak too soon but this seems to be working now without making any changes. Yesterday morning I found that the Satellite server itself was in the wrong timezone (MST). I had an engineer change it to EST then reboot it but it didn't make any difference with the script. Is it possible that it took a day to take affect? I'm very confused as to why this is working now.