Revision 276e51bd lib/cli.py
b/lib/cli.py | ||
---|---|---|
2199 | 2199 |
return SubmitOpCode(op, cl=cl, feedback_fn=feedback_fn, opts=opts) |
2200 | 2200 |
|
2201 | 2201 |
|
2202 |
def _InitReasonTrail(op, opts): |
|
2203 |
"""Builds the first part of the reason trail |
|
2204 |
|
|
2205 |
Builds the initial part of the reason trail, adding the user provided reason |
|
2206 |
(if it exists) and the name of the command starting the operation. |
|
2207 |
|
|
2208 |
@param op: the opcode the reason trail will be added to |
|
2209 |
@param opts: the command line options selected by the user |
|
2210 |
|
|
2211 |
""" |
|
2212 |
assert len(sys.argv) >= 2 |
|
2213 |
trail = [] |
|
2214 |
|
|
2215 |
if opts.reason: |
|
2216 |
trail.append((constants.OPCODE_REASON_SRC_USER, |
|
2217 |
opts.reason, |
|
2218 |
utils.EpochNano())) |
|
2219 |
|
|
2220 |
binary = os.path.basename(sys.argv[0]) |
|
2221 |
source = "%s:%s" % (constants.OPCODE_REASON_SRC_CLIENT, binary) |
|
2222 |
command = sys.argv[1] |
|
2223 |
trail.append((source, command, utils.EpochNano())) |
|
2224 |
op.reason = trail |
|
2225 |
|
|
2226 |
|
|
2202 | 2227 |
def SetGenericOpcodeOpts(opcode_list, options): |
2203 | 2228 |
"""Processor for generic options. |
2204 | 2229 |
|
... | ... | |
2218 | 2243 |
op.dry_run = options.dry_run |
2219 | 2244 |
if getattr(options, "priority", None) is not None: |
2220 | 2245 |
op.priority = options.priority |
2246 |
_InitReasonTrail(op, options) |
|
2221 | 2247 |
|
2222 | 2248 |
|
2223 | 2249 |
def GetClient(query=False): |
Also available in: Unified diff