Revision d6cd74dd lib/cli.py
b/lib/cli.py | ||
---|---|---|
165 | 165 |
"PREALLOC_WIPE_DISKS_OPT", |
166 | 166 |
"PRIMARY_IP_VERSION_OPT", |
167 | 167 |
"PRIMARY_ONLY_OPT", |
168 |
"PRINT_JOBID_OPT", |
|
168 | 169 |
"PRIORITY_OPT", |
169 | 170 |
"RAPI_CERT_OPT", |
170 | 171 |
"READD_OPT", |
... | ... | |
198 | 199 |
"SRC_DIR_OPT", |
199 | 200 |
"SRC_NODE_OPT", |
200 | 201 |
"SUBMIT_OPT", |
202 |
"SUBMIT_OPTS", |
|
201 | 203 |
"STARTUP_PAUSED_OPT", |
202 | 204 |
"STATIC_OPT", |
203 | 205 |
"SYNC_OPT", |
... | ... | |
832 | 834 |
help=("Submit the job and return the job ID, but" |
833 | 835 |
" don't wait for the job to finish")) |
834 | 836 |
|
837 |
PRINT_JOBID_OPT = cli_option("--print-jobid", dest="print_jobid", |
|
838 |
default=False, action="store_true", |
|
839 |
help=("Additionally print the job as first line" |
|
840 |
" on stdout (for scripting).")) |
|
841 |
|
|
835 | 842 |
SYNC_OPT = cli_option("--sync", dest="do_locking", |
836 | 843 |
default=False, action="store_true", |
837 | 844 |
help=("Grab locks while doing the queries" |
... | ... | |
1634 | 1641 |
#: Options provided by all commands |
1635 | 1642 |
COMMON_OPTS = [DEBUG_OPT, REASON_OPT] |
1636 | 1643 |
|
1644 |
# options related to asynchronous job handling |
|
1645 |
|
|
1646 |
SUBMIT_OPTS = [ |
|
1647 |
SUBMIT_OPT, |
|
1648 |
PRINT_JOBID_OPT, |
|
1649 |
] |
|
1650 |
|
|
1637 | 1651 |
# common options for creating instances. add and import then add their own |
1638 | 1652 |
# specific ones. |
1639 | 1653 |
COMMON_CREATE_OPTS = [ |
... | ... | |
1654 | 1668 |
OSPARAMS_OPT, |
1655 | 1669 |
OS_SIZE_OPT, |
1656 | 1670 |
SUBMIT_OPT, |
1671 |
PRINT_JOBID_OPT, |
|
1657 | 1672 |
TAG_ADD_OPT, |
1658 | 1673 |
DRY_RUN_OPT, |
1659 | 1674 |
PRIORITY_OPT, |
... | ... | |
2248 | 2263 |
SetGenericOpcodeOpts([op], opts) |
2249 | 2264 |
|
2250 | 2265 |
job_id = SendJob([op], cl=cl) |
2266 |
if opts.print_jobid: |
|
2267 |
ToStdout("%d" % job_id) |
|
2251 | 2268 |
|
2252 | 2269 |
op_results = PollJob(job_id, cl=cl, feedback_fn=feedback_fn, |
2253 | 2270 |
reporter=reporter) |
... | ... | |
2271 | 2288 |
job = [op] |
2272 | 2289 |
SetGenericOpcodeOpts(job, opts) |
2273 | 2290 |
job_id = SendJob(job, cl=cl) |
2291 |
if opts.print_jobid: |
|
2292 |
ToStdout("%d" % job_id) |
|
2274 | 2293 |
raise JobSubmittedException(job_id) |
2275 | 2294 |
else: |
2276 | 2295 |
return SubmitOpCode(op, cl=cl, feedback_fn=feedback_fn, opts=opts) |
Also available in: Unified diff