0

I am trying to create a python script that interfaces with RHN Satellite's API. The code below schedules a remote command to be run instantly against the specified server( var id). The problem is that the Satellite server schedules the command exactly 2 hours after I specify. I cannot find where this is taking place. The Satellite server and clients are all RHEL6. Here is my code:

#!/bin/python
import xmlrpclib
from datetime import date, datetime, time, timedelta
from sys import argv
import socket
import os

SATELLITE_URL = "https://URL"
SATELLITE_LOGIN = "username"
SATELLITE_PASSWORD = "password"
client = xmlrpclib.Server(SATELLITE_URL, verbose=0)
key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD)
id = [] #Satellite server ID
script = "#!/bin/sh \n yum update -y"


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 print the variable "earliest_occurrence" it prints the current time. When I do a "date" on the Satellite server it prints the correct time.

Any help would be greatly appreciated. Thanks!

1 Answers1

0

This is now resolved but I am not exactly sure how. The two things I confirmed were that the Satellite server itself was in the correct timezone (EST vs. MST), the other was I confirmed that the account used to generate the API key was set for the correct timezone. The issue seemed to go away after I logged in to Satellite with the API account. So, unfortunately I am not sure what fixed it because I didn't change anything. But, these are things to verify if having the same issue.