From 43b0a2a62c478c18d4bf6a5f09be3dd5ce48270b Mon Sep 17 00:00:00 2001 From: brent s Date: Tue, 2 Jul 2019 15:12:37 -0400 Subject: [PATCH] make yum_pkgs plugin executable standalone --- plugins/yum_pkgs.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugins/yum_pkgs.py b/plugins/yum_pkgs.py index f845fb4..5e2b55b 100644 --- a/plugins/yum_pkgs.py +++ b/plugins/yum_pkgs.py @@ -227,3 +227,21 @@ class Backup(object): with open(self.output, 'wb') as f: f.write(self.pkglist) return() + +if __name__ == '__main__': + import argparse + args = argparse.ArgumentParser(description = 'Parse and report installed packages') + args.add_argument('-x', '--no-explicit', + dest = 'explicit_only', + action = 'store_false', + help = ('If specified, catalogue ALL installed packages, ' + 'not ones only explicitly-installed (implies -i/--includes)')) + args.add_argument('-i', '--includes', + dest = 'include_deps', + action = 'store_true', + help = ('If specified, include packages installed as dependencies')) + args.add_argument('output', + help = 'The file to write the XML output to.') + args = vars(args.parse_args()) + b = Backup(**args) +