def load_data(file): isJson = check_extension_is_json(file) if isJson: print "you provided a json file, checking the syntax..." data = generics_utils.check_json_syntax(file) else: print "you provided a yaml file, checking the syntax..." data = generics_utils.check_yaml_syntax(file) return data
def validate_deployment(file): try: isJson = check_extension_is_json(file) if isJson: data = generics_utils.check_json_syntax(file) else: data = generics_utils.check_yaml_syntax(file) if data is None: return if "provisioner" not in data: printer.out("There is no provisioner in the file", printer.ERROR) return data["provisioner"] except ValueError as e: printer.out("JSON parsing error: " + str(e), printer.ERROR) printer.out("Syntax of deployment file [" + file + "]: FAILED") except IOError as e: printer.out("unknown error deployment json file", printer.ERROR)
def validate_configurations_file(file, isJson): if isJson: data = generics_utils.check_json_syntax(file) else: data = generics_utils.check_yaml_syntax(file) if data is None: return #check manadatory fields if "stack" in data: stack=check_mandatory_stack(data["stack"]) if stack is None: return #else: # print "No stack section find in the template file" # return if "builders" in data: check_mandatory_builders(data["builders"]) return data
def validate_configurations_file(file, isJson): if isJson: data = generics_utils.check_json_syntax(file) else: data = generics_utils.check_yaml_syntax(file) if data is None: return #check manadatory fields if "stack" in data: stack=check_mandatory_stack(data["stack"]) if stack is None: return if "bundles" in data["stack"]: for bundle in data["stack"]["bundles"]: bundle = check_bundle(bundle) if bundle is None: return if "builders" in data: check_mandatory_builders(data["builders"]) return data
def validate_configurations_file(file, isJson): if isJson: data = generics_utils.check_json_syntax(file) else: data = generics_utils.check_yaml_syntax(file) if data is None: return #check manadatory fields if "stack" in data: stack = check_mandatory_stack(data["stack"]) if stack is None: return if "bundles" in data["stack"]: for bundle in data["stack"]["bundles"]: bundle = check_bundle(bundle) if bundle is None: return if "builders" in data: check_mandatory_builders(data["builders"]) return data
def validate_bundle(file): try: isJson = check_extension_is_json(file) if isJson: print "you provided a json file, checking..." data = generics_utils.check_json_syntax(file) else: print "you provided a yaml file, checking..." data = generics_utils.check_yaml_syntax(file) if data is None: return data = check_bundle(data) if data is None: return return data except ValueError as e: printer.out("JSON parsing error: "+str(e), printer.ERROR) printer.out("Syntax of bundle file ["+file+"]: FAILED") except IOError as e: printer.out("unknown error bundle json file", printer.ERROR)
def validate_bundle(file): try: isJson = check_extension_is_json(file) if isJson: print "you provided a json file, checking..." data = generics_utils.check_json_syntax(file) else: print "you provided a yaml file, checking..." data = generics_utils.check_yaml_syntax(file) if data is None: return data = check_bundle(data) if data is None: return return data except ValueError as e: printer.out("JSON parsing error: " + str(e), printer.ERROR) printer.out("Syntax of bundle file [" + file + "]: FAILED") except IOError as e: printer.out("unknown error bundle json file", printer.ERROR)