(self, cmdp, exec_engine=None)
Read command line options into variables
Read command line options into variables
Read command line options into variables
def _get_run_options(self, cmdp, exec_engine=None):
        """Read command line options into variables"""
        cmdp.declare_options("-v= -e= -w= -u= -p= -i -t -a -P")
        cmd_options = {
            "netcoop": {
                "fl": ("-P", "--publish-all", "--netcoop",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "portsmap": {
                "fl": ("-p=", "--publish=",), "act": "E",
                "p2": "CMD_OPT", "p3": True
            },
            "novol": {
                "fl": ("--novol=",), "act": "R",
                "p2": "CMD_OPT", "p3": True
            },
            "vol": {
                "fl": ("-v=", "--volume=",), "act": "E",
                "p2": "CMD_OPT", "p3": True
            },
            "env": {
                "fl": ("-e=", "--env=",), "act": "E",
                "p2": "CMD_OPT", "p3": True
            },
            "envfile": {
                "fl": ("--env-file=",), "act": 'E',
                "p2": "CMD_OPT", "p3": True
            },
            "user": {
                "fl": ("-u=", "--user=",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "cwd": {
                "fl": ("-w=", "--workdir=",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "entryp": {
                "fl": ("--entrypoint=",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "cpuset": {
                "fl": ("--cpuset-cpus=",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "hostauth": {
                "fl": ("--hostauth",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "containerauth": {
                "fl": ("--containerauth",), "act": 'R',
                "p2": "CMD_OPT", "p3": False
            },
            "nosysdirs": {
                "fl": ("--nosysdirs",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "hostenv": {
                "fl": ("--hostenv",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "bindhome": {
                "fl": ("--bindhome",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "nometa": {
                "fl": ("--nometa",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "dri": {
                "fl": ("--dri",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "cmd": {
                "fl": ("P+",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "volfrom": {
                "fl": ("--volumes-from=",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "dns": {
                "fl": ("--dns=",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "dnssearch": {
                "fl": ("--dns-search=",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "kernel": {
                "fl": ("--kernel=",), "act": "R",
                "p2": "CMD_OPT", "p3": False
            },
            "devices": {
                "fl": ("--device=",), "act": "E",
                "p2": "CMD_OPT", "p3": True
            },
            "nobanner": {
                "fl": ("--nobanner",), "act": 'R',
                "p2": "CMD_OPT", "p3": False
            }
        }
        for option, cmdp_args in list(cmd_options.items()):
            last_value = None
            for cmdp_fl in cmdp_args["fl"]:
                option_value = cmdp.get(cmdp_fl, cmdp_args["p2"],
                                        cmdp_args["p3"])
                if not exec_engine:
                    continue
                if cmdp_args["act"] == "R":   # action is replace
                    if option_value or last_value is None:
                        exec_engine.opt[option] = option_value
                elif cmdp_args["act"] == "E":   # action is extend
                    #if option == "env":
                    #    print (type(option_value))
                    #    print (option_value)
                    exec_engine.opt[option].extend(option_value)
                last_value = option_value
def _get_run_options ( self , cmdp , exec_engine = None ) : cmdp . declare_options ( "-v= -e= -w= -u= -p= -i -t -a -P" ) cmd_options = { "netcoop" : { "fl" : ( "-P" , "--publish-all" , "--netcoop" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "portsmap" : { "fl" : ( "-p=" , "--publish=" , ) , "act" : "E" , "p2" : "CMD_OPT" , "p3" : True } , "novol" : { "fl" : ( "--novol=" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : True } , "vol" : { "fl" : ( "-v=" , "--volume=" , ) , "act" : "E" , "p2" : "CMD_OPT" , "p3" : True } , "env" : { "fl" : ( "-e=" , "--env=" , ) , "act" : "E" , "p2" : "CMD_OPT" , "p3" : True } , "envfile" : { "fl" : ( "--env-file=" , ) , "act" : 'E' , "p2" : "CMD_OPT" , "p3" : True } , "user" : { "fl" : ( "-u=" , "--user=" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "cwd" : { "fl" : ( "-w=" , "--workdir=" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "entryp" : { "fl" : ( "--entrypoint=" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "cpuset" : { "fl" : ( "--cpuset-cpus=" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "hostauth" : { "fl" : ( "--hostauth" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "containerauth" : { "fl" : ( "--containerauth" , ) , "act" : 'R' , "p2" : "CMD_OPT" , "p3" : False } , "nosysdirs" : { "fl" : ( "--nosysdirs" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "hostenv" : { "fl" : ( "--hostenv" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "bindhome" : { "fl" : ( "--bindhome" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "nometa" : { "fl" : ( "--nometa" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "dri" : { "fl" : ( "--dri" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "cmd" : { "fl" : ( "P+" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "volfrom" : { "fl" : ( "--volumes-from=" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "dns" : { "fl" : ( "--dns=" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "dnssearch" : { "fl" : ( "--dns-search=" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "kernel" : { "fl" : ( "--kernel=" , ) , "act" : "R" , "p2" : "CMD_OPT" , "p3" : False } , "devices" : { "fl" : ( "--device=" , ) , "act" : "E" , "p2" : "CMD_OPT" , "p3" : True } , "nobanner" : { "fl" : ( "--nobanner" , ) , "act" : 'R' , "p2" : "CMD_OPT" , "p3" : False } } for option , cmdp_args in list ( cmd_options . items ( ) ) : last_value = None for cmdp_fl in cmdp_args [ "fl" ] : option_value = cmdp . get ( cmdp_fl , cmdp_args [ "p2" ] , cmdp_args [ "p3" ] ) if not exec_engine : continue if cmdp_args [ "act" ] == "R" : # action is replace if option_value or last_value is None : exec_engine . opt [ option ] = option_value elif cmdp_args [ "act" ] == "E" : # action is extend #if option == "env": #    print (type(option_value)) #    print (option_value) exec_engine . opt [ option ] . extend ( option_value ) last_value = option_value