Revision b5430a9f
b/image_creator/main.py | ||
---|---|---|
49 | 49 |
dirname = os.path.dirname(value) |
50 | 50 |
name = os.path.basename(value) |
51 | 51 |
if dirname and not os.path.isdir(dirname): |
52 |
parser.error("`%s' is not an existing directory" % dirname)
|
|
52 |
raise FatalError("`%s' is not an existing directory" % dirname)
|
|
53 | 53 |
|
54 | 54 |
if not name: |
55 |
parser.error("`%s' is not a valid file name" % dirname)
|
|
55 |
raise FatalError("`%s' is not a valid file name" % dirname)
|
|
56 | 56 |
|
57 | 57 |
setattr(parser.values, option.dest, value) |
58 | 58 |
|
... | ... | |
75 | 75 |
help="dump image to FILE", metavar="FILE") |
76 | 76 |
|
77 | 77 |
parser.add_option("--enable-sysprep", dest="enabled_syspreps", default=[], |
78 |
help="Run SYSPREP operation on the input media",
|
|
78 |
help="run SYSPREP operation on the input media",
|
|
79 | 79 |
action="append", metavar="SYSPREP") |
80 | 80 |
|
81 | 81 |
parser.add_option("--disable-sysprep", dest="disabled_syspreps", |
82 |
help="Prevent SYSPREP operation from running on the input media",
|
|
82 |
help="prevent SYSPREP operation from running on the input media",
|
|
83 | 83 |
default=[], action="append", metavar="SYSPREP") |
84 | 84 |
|
85 | 85 |
parser.add_option("--print-sysprep", dest="print_sysprep", default=False, |
86 |
help="Print the enabled and disabled sysprep operations for this "
|
|
86 |
help="print the enabled and disabled sysprep operations for this "
|
|
87 | 87 |
"input media", action="store_true") |
88 | 88 |
|
89 | 89 |
parser.add_option("-s", "--silent", dest="silent", default=False, |
90 | 90 |
help="silent mode, only output errors", action="store_true") |
91 | 91 |
|
92 |
parser.add_option("-u", "--upload", dest="upload", default=False, |
|
93 |
help="upload the image to pithos", action="store_true") |
|
92 |
parser.add_option("-u", "--upload", dest="upload", type="string", |
|
93 |
default=False, help="upload the image to pithos with name FILENAME", |
|
94 |
metavar="FILENAME") |
|
94 | 95 |
|
95 |
parser.add_option("-r", "--register", dest="register", default=False, |
|
96 |
help="register the image to ~okeanos", action="store_true") |
|
96 |
parser.add_option("-r", "--register", dest="register", type="string", |
|
97 |
default=False, help="register the image to ~okeanos as IMAGENAME", |
|
98 |
metavar="IMAGENAME") |
|
97 | 99 |
|
98 | 100 |
options, args = parser.parse_args(input_args) |
99 | 101 |
|
... | ... | |
101 | 103 |
parser.error('Wrong number of arguments') |
102 | 104 |
options.source = args[0] |
103 | 105 |
if not os.path.exists(options.source): |
104 |
parser.error('input media is not accessible')
|
|
106 |
raise FatalError("Input media `%s' is not accessible" % options.source)
|
|
105 | 107 |
|
106 |
if options.register:
|
|
107 |
options.upload = True
|
|
108 |
if options.register and options.upload == False:
|
|
109 |
raise FatalError("You also need to set -u when -r option is set")
|
|
108 | 110 |
|
109 | 111 |
return options |
110 | 112 |
|
Also available in: Unified diff