candlepin/candlepin — pull request #116 by jmrodri (2012-11-20 22:13:34+00:00)
Title: export consumer's identity certificate / keypair 

This pull request will export the upstream consumer's identity certificate and keypair. It will also import them into the cp_upstream_consumer table and associate them to the owner. This also adds a new API to get the upstreamconsumers (returns a list of 1)

TEST PLAN
------------------
This uses cpc as the client to test this patch out.

1. register a consumer
* ./cpc register mymachine candlepin eb5e04bf-be27-44cf-abe3-0c0b1edd523e '{"key" => "fact"}' admin admin

2. get the pool id for Awesome OS for x86_64 (you will need this number later):
* psql -U candlepin -c "select id, productname from cp_pool where productname = 'Awesome OS for x86_64' limit 1;" | grep Awesome | awk '{print $1}'

3. consume the above pool
* ./cpc consume_pool IDFROMABOVE '{:quantity => "5", :uuid => "eb5e04bf-be27-44cf-abe3-0c0b1edd523e"}'

4. make a temp directory
* mkdir /tmp/demo

5. export the manifest
* ./cpc --uuid eb5e04bf-be27-44cf-abe3-0c0b1edd523e export_consumer /tmp/demo

6. create a new org to import into:
* ./cpc create_owner orgB

7. import the manifest into the new org
* ./cpc import orgB /tmp/demo/export.zip

8. now get the upstream consumer from the api:
* curl -k -u admin:admin https://localhost:8443/candlepin/owners/orgB/upstream_consumers