#!/usr/bin/python
# This program sets the custom values in Satellite.
# It accepts on the command line (in this order):
#  -system ID to apply values to
#  -field name
#  -value
#
# 1. read command-line arguments of: system ID, field names, & values
# 2. write custom info into Satellite
#
import xmlrpclib

SATELLITE_URL = "https://satellite.example.com/rpc/api")
SATELLITE_LOGIN = username
SATELLITE_PASSWORD = password
client = xmlrpclib.Server(SATELLITE_URL, verbose=0)
key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD)

def main():
  system_id = sys.argv[1]
  field_name = sys.argv[2]
  field_value = sys.argv[3]
  client.system.set_CustomValues(key,system_id,{field_name: field_value})

main()
client.auth.logout(key)
