diff options
Diffstat (limited to 'openecomp-be/tools/build')
-rw-r--r-- | openecomp-be/tools/build/scripts/action_library_client/action_library_client.py | 59 | ||||
-rw-r--r-- | openecomp-be/tools/build/scripts/parse-json.py | 14 |
2 files changed, 38 insertions, 35 deletions
diff --git a/openecomp-be/tools/build/scripts/action_library_client/action_library_client.py b/openecomp-be/tools/build/scripts/action_library_client/action_library_client.py index 7f513afe86..0537128665 100644 --- a/openecomp-be/tools/build/scripts/action_library_client/action_library_client.py +++ b/openecomp-be/tools/build/scripts/action_library_client/action_library_client.py @@ -147,6 +147,7 @@ class FinalizeStatus(object): class ArgsDict(dict): """A dict which makes attributes accessible as properties.""" + def __getattr__(self, attr): return self[attr] @@ -221,33 +222,33 @@ class ArgumentParser(object): def usage(): """Print usage message.""" print("" + - "Usage: action_library_client.py [--help] [--url <url>] [--in <filename>]\n" + - " [--out <filename>] [--config <filename>]\n" + - " [--log <filename>] [--uuid <uuid>]\n" + - " [--curl] [--dryrun] [--verbose] [--version]\n" + - " [--list | --create | --update= | --delete |\n" + - " --checkout | --undocheckout | --checkin | --submit]\n" + - "\n" + - "Optional arguments:\n" + - " --help Show this help message and exit\n" + - " --url <url> REST endpoint URL\n" + - " --in <filename> Path to JSON input file (else STDIN)\n" + - " --out <filename> Path to JSON output file (else STDOUT or logfile)\n" + - " --config <filename> Path to configuration file\n" + - " --log <filename> Path to logfile (else STDOUT)\n" + - " --uuid <uuid> Action UUID, (=='actionInvariantUUID')\n" + - " --curl Use curl transport impl\n" + - " --dryrun Describe what will happen, execute nothing\n" + - " --verbose Verbose diagnostic output\n" + - " --version Print script version and exit\n" + - " --list List actions\n" + - " --create Create new action (requires --in)\n" + - " --update Update existing action (requires --uuid, --in)\n" + - " --delete Delete existing action (requires --uuid)\n" + - " --checkout Create minor version candidate (requires --uuid)\n" + - " --undocheckout Discard minor version candidate (requires --uuid)\n" + - " --checkin Create minor version from candidate (requires --uuid)\n" + - " --submit Create next major version (requires --uuid)") + "Usage: action_library_client.py [--help] [--url <url>] [--in <filename>]\n" + + " [--out <filename>] [--config <filename>]\n" + + " [--log <filename>] [--uuid <uuid>]\n" + + " [--curl] [--dryrun] [--verbose] [--version]\n" + + " [--list | --create | --update= | --delete |\n" + + " --checkout | --undocheckout | --checkin | --submit]\n" + + "\n" + + "Optional arguments:\n" + + " --help Show this help message and exit\n" + + " --url <url> REST endpoint URL\n" + + " --in <filename> Path to JSON input file (else STDIN)\n" + + " --out <filename> Path to JSON output file (else STDOUT or logfile)\n" + + " --config <filename> Path to configuration file\n" + + " --log <filename> Path to logfile (else STDOUT)\n" + + " --uuid <uuid> Action UUID, (=='actionInvariantUUID')\n" + + " --curl Use curl transport impl\n" + + " --dryrun Describe what will happen, execute nothing\n" + + " --verbose Verbose diagnostic output\n" + + " --version Print script version and exit\n" + + " --list List actions\n" + + " --create Create new action (requires --in)\n" + + " --update Update existing action (requires --uuid, --in)\n" + + " --delete Delete existing action (requires --uuid)\n" + + " --checkout Create minor version candidate (requires --uuid)\n" + + " --undocheckout Discard minor version candidate (requires --uuid)\n" + + " --checkin Create minor version from candidate (requires --uuid)\n" + + " --submit Create next major version (requires --uuid)") ############################################################################### @@ -533,7 +534,7 @@ class CURLRESTClient(IRESTClient): """Debug curl command, for diags and dryrun.""" buf = "" for token in cmd: - if token is "curl" or token.startswith("-"): + if token == "curl" or token.startswith("-"): buf = "{0}{1} ".format(buf, token) else: buf = "{0}\"{1}\" ".format(buf, token) @@ -556,7 +557,7 @@ class CURLRESTClient(IRESTClient): try: separator = output.index("\r\n\r\n{") self.logger.debug("HTTP preamble:\n{0}".format(output[:separator])) - json_body = json.loads(output[(separator+4):]) + json_body = json.loads(output[(separator + 4):]) self.log_json_response(method, json_body) return json_body except ValueError: diff --git a/openecomp-be/tools/build/scripts/parse-json.py b/openecomp-be/tools/build/scripts/parse-json.py index 46537ceac5..83c70aac01 100644 --- a/openecomp-be/tools/build/scripts/parse-json.py +++ b/openecomp-be/tools/build/scripts/parse-json.py @@ -41,17 +41,19 @@ from collections import OrderedDict def readJsonFile(file, type): - with open(file, 'r') as f: - data = json.load(f, object_pairs_hook=OrderedDict) - return data[type] + with open(file, 'r') as f: + data = json.load(f, object_pairs_hook=OrderedDict) + return data[type] + def printJsonTypeEntries(jsonData): - for i in jsonData.keys(): - print jsonData[i] + ';' + for i in jsonData.keys(): + print(jsonData[i] + ';') def usage(): - print 'parseJsonFile.py [-f <json-file> & -t <cql-type: drop|create|insert|update|select]' + print('parseJsonFile.py [-f <json-file> & -t <cql-type: drop|create|insert|update|select]') + def main(argv): action = '' |