CLUSTER_UUID_NAME='cluster-uuid'
CLUSTER_OWNERSHIP_NAME='cluster-ownership'
+verbose = False
+
def run_command(cmd):
+ if verbose:
+ print "run_command: " + str(cmd)
child = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
(o, e) = child.communicate()
print >> sys.stderr, "Usage:"
print >> sys.stderr, "======\n"
- print >> sys.stderr, sys.argv[0] + " [<commands> [command-options]]\n"
+ print >> sys.stderr, sys.argv[0] + " [-v|--verbose] [<commands> [command-options]]\n"
print >> sys.stderr, "without any option, shows the data to be published and do nothing"
print >> sys.stderr, ""
+ print >> sys.stderr, "-v|--verbose: toggle verbose output on stdout"
+ print >> sys.stderr, ""
print >> sys.stderr, "commands:"
print >> sys.stderr, "publish - publish the brag report to the server"
print >> sys.stderr, "update-metadata <update-metadata-options> - Update"
print >> sys.stderr, "Cannot publish until a URL is set using update-metadata"
return 1
+ if verbose:
+ print "PUT " + str(url) + " : " + str(data)
req = requests.put(url, data=data)
if req.status_code is not 201:
print >> sys.stderr, "Failed to publish, server responded with code " + str(req.status_code)
return 0
def main():
+ if len(sys.argv) > 1 and ( sys.argv[1] == '--verbose' or sys.argv[1] == '-v' ):
+ global verbose
+ verbose = True
+ sys.argv.pop(1)
if len(sys.argv) is 1:
print output_json()[0]
return 0
- elif sys.argv[1] == 'update-metadata':
+ if sys.argv[1] == 'update-metadata':
return update_metadata()
elif sys.argv[1] == 'clear-metadata':
return clear_metadata()