Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
16
Merge Requests
16
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
047185fc
Commit
047185fc
authored
Jan 13, 2023
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
console: add getparams method in globals
parent
b72c0fc2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
slapos/cli/console.py
slapos/cli/console.py
+6
-1
slapos/client.py
slapos/client.py
+3
-0
No files found.
slapos/cli/console.py
View file @
047185fc
...
@@ -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
]):
...
...
slapos/client.py
View file @
047185fc
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment