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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
slapos.core
Commits
b6da47f0
Commit
b6da47f0
authored
Jul 12, 2011
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow shorthand methods to behave like real ones
parent
b03de839
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
slapos/console.py
slapos/console.py
+12
-5
No files found.
slapos/console.py
View file @
b6da47f0
...
@@ -111,7 +111,6 @@ class Config:
...
@@ -111,7 +111,6 @@ class Config:
setattr
(
self
,
'master_url'
,
master_url
)
setattr
(
self
,
'master_url'
,
master_url
)
def
init
(
config
):
def
init
(
config
):
"""Initialize Slap instance, connect to server and create
"""Initialize Slap instance, connect to server and create
aliases to common software releases"""
aliases to common software releases"""
slap
=
slapos
.
slap
.
slap
()
slap
=
slapos
.
slap
.
slap
()
...
@@ -133,10 +132,18 @@ def init(config):
...
@@ -133,10 +132,18 @@ def init(config):
# Create global variable too see available aliases
# Create global variable too see available aliases
local
[
'software_list'
]
=
software_list
local
[
'software_list'
]
=
software_list
# Create global shortcut functions to request instance and software
# Create global shortcut functions to request instance and software
local
[
'request'
]
=
lambda
software_release
,
reference
:
\
# XXX-Cedric : can we change given parameters to something like
slap
.
registerOpenOrder
().
request
(
software_release
,
reference
)
# *args, **kwargs, but without the bad parts, in order to be generic?
local
[
'supply'
]
=
lambda
software_release
,
computer
:
\
def
shorthandRequest
(
software_release
,
partition_reference
,
slap
.
registerSupply
().
supply
(
software_release
,
computer
)
partition_parameter_kw
=
None
,
software_type
=
None
,
filter_kw
=
None
,
state
=
None
):
slap
.
registerOpenOrder
().
request
(
software_release
,
partition_reference
,
partition_parameter_kw
,
software_type
,
filter_kw
,
state
)
def
shorthandSupply
(
software_release
,
computer_guid
=
None
):
slap
.
registerSupply
().
supply
(
software_release
,
computer_guid
)
local
[
'request'
]
=
shorthandRequest
local
[
'supply'
]
=
shorthandSupply
return
local
return
local
def
request
():
def
request
():
...
...
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