It is incorrect to append the content of CEPH_ARGS to the argument list
when running injectargs. For instance if
CEPH_ARGS='--log-file the.log' \
./ceph tell osd.0 injectargs --no-osd_debug_op_order
translates into
./ceph tell osd.0 injectargs --no-osd_debug_op_order \
--log-file the.log
it ends up changing the log file of osd.0 which is probably unintended.
Instead CEPH_ARGS is inserted before injectargs and it translates into:
./ceph tell osd.0 --log-file the.log \
injectargs --no-osd_debug_op_order
Signed-off-by: Loic Dachary <loic-201408@dachary.org>
function test_mon_injectargs()
{
+ CEPH_ARGS='--mon_debug_dump_location the.dump' ./ceph tell osd.0 injectargs --no-osd_debug_op_order >& $TMPFILE || return 1
+ check_response "osd_debug_op_order = 'false'"
+ ! grep "the.dump" $TMPFILE || return 1
ceph tell osd.0 injectargs '--osd_debug_op_order --osd_debug_drop_ping_probability 444' >& $TMPFILE || return 1
check_response "osd_debug_drop_ping_probability = '444' osd_debug_op_order = 'true'"
ceph tell osd.0 injectargs --no-osd_debug_op_order >& $TMPFILE || return 1
def main():
ceph_args = os.environ.get('CEPH_ARGS')
if ceph_args:
- sys.argv.extend(ceph_args.split())
-
+ if "injectargs" in sys.argv:
+ i = sys.argv.index("injectargs")
+ sys.argv = sys.argv[:i] + ceph_args.split() + sys.argv[i:]
+ else:
+ sys.argv.extend(ceph_args.split())
parser, parsed_args, childargs = parse_cmdargs()
if parsed_args.version: