Commit 047185fc authored by Joanne Hugé's avatar Joanne Hugé

console: add getparams method in globals

parent b72c0fc2
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
# #
############################################################################## ##############################################################################
import sys
import textwrap import textwrap
from slapos.cli.config import ClientConfigCommand from slapos.cli.config import ClientConfigCommand
...@@ -81,7 +82,10 @@ class ConsoleCommand(ClientConfigCommand): ...@@ -81,7 +82,10 @@ class ConsoleCommand(ClientConfigCommand):
action='store_true', action='store_true',
help='Use plain Python shell') help='Use plain Python shell')
shell.add_argument('script_file', nargs='?', ap.add_argument('--console_args', nargs='+',
help='Console args')
shell.add_argument('--script_file', nargs='?',
help='Script to run') help='Script to run')
return ap return ap
...@@ -95,6 +99,7 @@ class ConsoleCommand(ClientConfigCommand): ...@@ -95,6 +99,7 @@ class ConsoleCommand(ClientConfigCommand):
with open(args.script_file) as f: with open(args.script_file) as f:
code = compile(f.read(), args.script_file, 'exec') code = compile(f.read(), args.script_file, 'exec')
local['__file__'] = args.script_file local['__file__'] = args.script_file
sys.argv = [args.script_file] + args.console_args
return exec_(code, local, local) return exec_(code, local, local)
if not any([args.python, args.ipython, args.bpython]): if not any([args.python, args.ipython, args.bpython]):
......
...@@ -101,8 +101,11 @@ def init(conf, logger): ...@@ -101,8 +101,11 @@ def init(conf, logger):
def shorthandSupply(*args, **kwargs): def shorthandSupply(*args, **kwargs):
# XXX-Cedric Implement computer_group support # XXX-Cedric Implement computer_group support
return slap.registerSupply().supply(*args, **kwargs) return slap.registerSupply().supply(*args, **kwargs)
def getParams(*args, **kwargs):
return slap.registerOpenOrder().getInformation(*args, **kwargs)
local['request'] = shorthandRequest local['request'] = shorthandRequest
local['supply'] = shorthandSupply local['supply'] = shorthandSupply
local['getparams'] = getParams
local['product'] = SoftwareProductCollection(logger, slap) local['product'] = SoftwareProductCollection(logger, slap)
return local return local
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment