More bootstrap scripts.

This commit is contained in:
Ralph Bean
2017-03-22 13:09:29 -04:00
parent c7a581602f
commit f743aefe5a
3 changed files with 20 additions and 4 deletions

View File

@@ -1,5 +1,3 @@
import json
import requests
import os
import sys

View File

@@ -0,0 +1,20 @@
import os
import sys
import pdc_client
servername, token, variant_uid = sys.argv[-3], sys.argv[-2], sys.argv[-1]
if os.path.basename(__file__) in (servername, token, variant_uid,):
raise ValueError("Provide a PDC server name defined in /etc/pdc.d/ and a token")
print("Connecting to PDC server %r with token %r" % (servername, token))
pdc = pdc_client.PDCClient(servername, token=token)
print("Querying for %r to see if it is active" % variant_uid)
obj = pdc['unreleasedvariants'][variant_uid]()
assert obj['active'] == True, obj['active']
print("Submitting PATCH to deactivate.")
pdc['unreleasedvariants'][variant_uid] += {'variant_uid': variant_uid, 'active': False}
print("Done.")

View File

@@ -1,5 +1,3 @@
import json
import requests
import os
import sys