Add option for printing the needed sysprep params
[snf-image-creator] / image_creator / main.py
index edee4fe..8fecf1b 100644 (file)
@@ -121,6 +121,10 @@ def parse_options(input_args):
                       "input media", default=[], action="append",
                       metavar="SYSPREP")
 
+    parser.add_option("--print-sysprep-params", dest="print_sysprep_params",
+                      default=False, help="print the needed sysprep parameters"
+                      " for this input media", action="store_true")
+
     parser.add_option("--sysprep-param", dest="sysprep_params", default=[],
                       help="Add KEY=VALUE system preparation parameter",
                       action="append")
@@ -191,9 +195,9 @@ def image_creator():
     options = parse_options(sys.argv[1:])
 
     if options.outfile is None and not options.upload and not \
-            options.print_sysprep:
-        raise FatalError("At least one of `-o', `-u' or `--print-sysprep' "
-                         "must be set")
+            options.print_sysprep and not options.print_sysprep_params:
+        raise FatalError("At least one of `-o', `-u', `--print-sysprep' or "
+                         "`--print-sysprep-params' must be set")
 
     if options.silent:
         out = SilentOutput()
@@ -279,6 +283,10 @@ def image_creator():
             image.os.print_syspreps()
             out.output()
 
+        if options.print_sysprep_params:
+            image.os.print_sysprep_params()
+            out.output()
+
         if options.outfile is None and not options.upload:
             return 0