class HypervisorCheckinTests(unittest.TestCase): def setUp(self): self.cp = UEPConnection(username="******", password="******", insecure=True) def test_hypervisor_checkin_can_pass_empty_map_and_updates_nothing(self): response = self.cp.hypervisorCheckIn("admin", "", {}) self.assertEqual(len(response['failedUpdate']), 0) self.assertEqual(len(response['updated']), 0) self.assertEqual(len(response['created']), 0)
#!/usr/bin/env python from rhsm.connection import UEPConnection import json cp = UEPConnection(host='lenovo.local.rm-rf.ca', ssl_port=8443, handler='/candlepin', username='******', password='******') #cp = UEPConnection( # host='subscription.rhn.redhat.com', # ssl_port=443, # cert_file='/etc/pki/consumer/cert.pem', # key_file='/etc/pki/consumer/key.pem') mapping = json.loads( open('/home/dgoodwin/src/candlepin/server/virtperf/checkin.json').read()) cp.hypervisorCheckIn('virtperf', None, mapping) #cp.hypervisorCheckIn('5894300', None, mapping)
#!/usr/bin/env python # usage: # vsphere-virt-who-simulator.py -o ACME_Corporation -e Dev host1:guest1,guest2 host3:guest3,guest4 from rhsm.connection import UEPConnection from optparse import OptionParser parser = OptionParser() parser.add_option("-o", "--org", default="ACME_Corporation") parser.add_option("-e", "--env", default="Dev") [options, args] = parser.parse_args() conn = UEPConnection(cert_file="/etc/pki/consumer/cert.pem", key_file="/etc/pki/consumer/key.pem", insecure=True) # takes array in format ["host1:guest1,guest2","host2:guest3,guest4"] # returns dict {"host1": ["guest1","guest2"], "host2": ["guest3","guest4"]} mapping = dict([[host, guests.split(",")] for [host, guests] in [arg.split(":") for arg in args]]) print conn.hypervisorCheckIn(options.org, options.env, mapping)
#!/usr/bin/env python # usage: # vsphere-virt-who-simulator.py -o ACME_Corporation -e Dev host1:guest1,guest2 host3:guest3,guest4 from rhsm.connection import UEPConnection from optparse import OptionParser parser = OptionParser() parser.add_option("-o", "--org", default="ACME_Corporation") parser.add_option("-e", "--env", default="Dev") [options, args] = parser.parse_args() conn = UEPConnection(cert_file="/etc/pki/consumer/cert.pem",key_file="/etc/pki/consumer/key.pem", insecure=True) # takes array in format ["host1:guest1,guest2","host2:guest3,guest4"] # returns dict {"host1": ["guest1","guest2"], "host2": ["guest3","guest4"]} mapping = dict([[host, guests.split(",")] for [host, guests] in [arg.split(":") for arg in args]]) print conn.hypervisorCheckIn(options.org, options.env, mapping)
#!/usr/bin/env python from rhsm.connection import UEPConnection import json cp = UEPConnection( host='lenovo.local.rm-rf.ca', ssl_port=8443, handler='/candlepin', username='******', password='******') #cp = UEPConnection( # host='subscription.rhn.redhat.com', # ssl_port=443, # cert_file='/etc/pki/consumer/cert.pem', # key_file='/etc/pki/consumer/key.pem') mapping = json.loads(open('/home/dgoodwin/src/candlepin/server/virtperf/checkin.json').read()) cp.hypervisorCheckIn('virtperf', None, mapping) #cp.hypervisorCheckIn('5894300', None, mapping)