X-Git-Url: https://pwan.org/git/?p=salty_linter.git;a=blobdiff_plain;f=bin%2Fsalty-linter;h=07843117f25b41d14b348e0eb994fd2ae3df5de2;hp=c06aa1fa11b26527c75194e42f91ac57038466ec;hb=55d062e15f67f50f5bb15eb4a233851295b875da;hpb=9c0a853a3d3328c63336c6f62cde8f3b6404da47 diff --git a/bin/salty-linter b/bin/salty-linter index c06aa1f..0784311 100755 --- a/bin/salty-linter +++ b/bin/salty-linter @@ -6,7 +6,6 @@ import os.path import pkg_resources import pprint import sys -import yaml from ruamel.yaml import YAML import salty_linter @@ -20,24 +19,12 @@ argparser = argparse.ArgumentParser(description="salty-linter. Let's lint some s epilog='Now let\'s get some salt states in ship shop shape !') argparser.add_argument('--verbose', dest='verbose', action='store_true', help="Let's be super chatty and generate a lot of output.") argparser.add_argument('--no-werror', dest='werror', action='store_false', help="Don't treat warnings as errors") -argparser.add_argument('--typedb', nargs='?', default=default_types, type=argparse.FileType('r'), help="alternative type database.") argparser.add_argument('sls', nargs='+', help="list of salt state files") argparser.set_defaults(verbose=False, werror=True) args = argparser.parse_args() -pp.pprint(args) - if args.verbose: - print("HI I'M SALTY_LINTER. LETS GET CHATTY.") - -# Open the type database file and read in the type database -# Error out of that file doesn't parse / doesn't exist / is unreadab -typedb = yaml.load(args.typedb) - -if args.verbose: - print("HERE'S YOUR TYPE DATABSE. WALLOW IN IT.") - pp.pprint(typedb) - print("WRAP UP YOUR TYPE DATABASE WALLOWING.") + print("HELLO EVERYONE I'M SALTY-LINTER AND I'M VERBOSE.") exit_status = 0 for an_sls_filename in args.sls: @@ -55,9 +42,9 @@ for an_sls_filename in args.sls: continue with open(fullpath_sls_filename) as fp: - yaml = YAML(typ='rt') + yaml = YAML(typ='jinja2') sls_yaml = yaml.load(fp) - (lint_errors, lint_warnings) = salty_linter.lint(sls_yaml, typedb) + (lint_errors, lint_warnings) = salty_linter.lint(sls_yaml) if lint_errors or (lint_warnings and args.werror): exit_status = 1 for (line_number, an_error) in lint_errors: @@ -67,7 +54,6 @@ for an_sls_filename in args.sls: if exit_status == 0: print("NO OBVIOUS FAILURES.") -else: - print("MORE SHIP-SHOPPING FOR YOU !") + sys.exit(exit_status)