cwctl.py
changeset 5430 ed8f71e244f8
parent 5426 0d4853a6e5ee
child 5436 2455ca3a2a3a
equal deleted inserted replaced
5427:f0ea91195ef6 5430:ed8f71e244f8
   779     connection, unless -P option is specified, in which case you will be
   779     connection, unless -P option is specified, in which case you will be
   780     connected through pyro. In the later case, you won't have access to
   780     connected through pyro. In the later case, you won't have access to
   781     repository internals (session, etc...) so most migration commands won't be
   781     repository internals (session, etc...) so most migration commands won't be
   782     available.
   782     available.
   783 
   783 
       
   784     Arguments after bare "--" string will not be processed by the shell command
       
   785     You can use it to pass extra arguments to your script and expect for
       
   786     them in 'scriptargs' afterwards.
       
   787 
   784     <instance>
   788     <instance>
   785       the identifier of the instance to connect.
   789       the identifier of the instance to connect.
   786     """
   790     """
   787     name = 'shell'
   791     name = 'shell'
   788     arguments = '<instance> [batch command file]'
   792     arguments = '<instance> [batch command file(s)] [-- <script arguments>]'
   789     options = (
   793     options = (
   790         ('system-only',
   794         ('system-only',
   791          {'short': 'S', 'action' : 'store_true',
   795          {'short': 'S', 'action' : 'store_true',
   792           'help': 'only connect to the system source when the instance is '
   796           'help': 'only connect to the system source when the instance is '
   793           'using multiple sources. You can\'t use this option and the '
   797           'using multiple sources. You can\'t use this option and the '
   859             config.set_sources_mode(sources)
   863             config.set_sources_mode(sources)
   860             config.repairing = self.config.force
   864             config.repairing = self.config.force
   861             mih = config.migration_handler()
   865             mih = config.migration_handler()
   862         try:
   866         try:
   863             if args:
   867             if args:
   864                 for arg in args:
   868                 # use cmdline parser to access left/right attributes only
   865                     mih.cmd_process_script(arg)
   869                 # remember that usage requires instance appid as first argument
       
   870                 scripts, args = self.cmdline_parser.largs[1:], self.cmdline_parser.rargs
       
   871                 for script in scripts:
       
   872                     mih.cmd_process_script(script, args=args)
   866             else:
   873             else:
   867                 mih.interactive_shell()
   874                 mih.interactive_shell()
   868         finally:
   875         finally:
   869             if not self.config.pyro:
   876             if not self.config.pyro:
   870                 mih.shutdown()
   877                 mih.shutdown()