def prod_difference(): style = "pretty" parser = argparse.ArgumentParser() parser.add_argument("difference") parser.add_argument("--json", action="store_true") parser.add_argument("leftID") parser.add_argument("rightID") args = parser.parse_args() leftID = 0 rightID = 0 try: leftID = int(args.leftID) rightID = int(args.rightID) except ValueError: print("That's not a number!") exit() output = "" output = da_cli_script.requests_get(da_cli_script.da_server + "/products/diff?leftProduct="+str(leftID)+"&rightProduct="+str(rightID)).json() if style == "pretty": if "errorType" in output: print(output['errorMessage']) exit() pretty_out = pretty.difference(output) print(pretty_out) exit() else: print(json.dumps(output))
def check(color_par, gav): if (color_par == "b") or color_par == "black": pass else: print("Unrecognized color. Supported color is b[lack]") exit() if matchGAV(gav): groupId, artifactId, version = gav.split(":", 3) else: exit() response = da_cli_script.requests_get(da_cli_script.da_server + "/listings/blacklist/gav?groupid=" + groupId + "&artifactid=" + artifactId + "&version=" + version) output = response.json() output = (json.dumps(output)) if '"contains": true' in output: print("Artifact " + gav + " is blacklisted - actual verisions in list: ") print(pretty.listCheck(json.loads(output))) elif '"contains": false' in output: print("Artifact " + gav + " is NOT blacklisted") else: print("Error checking " + gav)
def prod_difference(): style = "pretty" parser = argparse.ArgumentParser() parser.add_argument("difference") parser.add_argument("--json", action="store_true") parser.add_argument("leftID") parser.add_argument("rightID") args = parser.parse_args() leftID = 0 rightID = 0 try: leftID = int(args.leftID) rightID = int(args.rightID) except ValueError: print("That's not a number!") exit() output = "" output = da_cli_script.requests_get(da_cli_script.da_server + "/products/diff?leftProduct=" + str(leftID) + "&rightProduct=" + str(rightID)).json() if style == "pretty": if "errorType" in output: print(output['errorMessage']) exit() pretty_out = pretty.difference(output) print(pretty_out) exit() else: print(json.dumps(output))
def check(color_par,gav): if (color_par == "b") or color_par == "black": pass else: print("Unrecognized color. Supported color is b[lack]") exit() if matchGAV(gav): groupId, artifactId, version = gav.split(":",3) else: exit() response = da_cli_script.requests_get(da_cli_script.da_server + "/listings/blacklist/gav?groupid="+groupId+"&artifactid="+artifactId+"&version="+version) output = response.json() output = (json.dumps(output)) if '"contains": true' in output: print("Artifact "+gav +" is blacklisted - actual verisions in list: ") print(pretty.listCheck(json.loads(output))) elif '"contains": false' in output: print("Artifact "+gav +" is NOT blacklisted") else: print("Error checking " +gav)