/usr/bin/targetcli-ng is in targetcli 1:3.0~pre4.1~ga55d018-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #! /usr/bin/python
'''
This file is part of LIO(tm).
Copyright (c) 2012-2014 by Datera, Inc.
More information on www.datera.io.
Original author: Jerome Martin <jxm@netiant.com>
Datera and LIO are trademarks of Datera, Inc., which may be registered in some
jurisdictions.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
'''
import sys
from pyparsing import ParseException
from rtslib.config import ConfigError
from targetcli.cli_live import CliLive
from targetcli.cli_config import CliConfig
from targetcli.cli_logger import logger as log
# TODO Add tests for non-interactive mode
# TODO Add batch mode if stdin is not a terminal
if __name__ == '__main__':
try:
args = sys.argv[1:]
if not args:
config = 'live'
CliLive(interactive=True).cmdloop()
elif args[0] == "configure" and len(args) == 1:
config = 'candidate'
CliConfig(interactive=True).cmdloop()
elif args[0] == "configure":
config = 'candidate'
CliConfig(interactive=False).onecmd(" ".join(args[1:]))
else:
config = 'live'
CliLive(interactive=False).onecmd(" ".join(args))
except IOError, e:
log.critical("Failed to read %s configuration: %s" % (config, e))
log.info("Check your user permissions")
except ParseException, e:
log.critical("Failed to parse %s configuration: %s" % (config, e))
except ParseException, e:
log.critical("Failed to validate %s configuration: %s" % (config, e))
|