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
f95ca3cc
Commit
f95ca3cc
authored
Jun 29, 2011
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Plain Diff
merge slapconsole_simplifications
parents
3caff17d
f3f2a4cc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
slapos/console.py
slapos/console.py
+17
-2
No files found.
slapos/console.py
View file @
f95ca3cc
...
...
@@ -89,13 +89,15 @@ class Config:
raise
ValueError
(
'master_url is required.'
)
def
init
(
config
):
"""Initialize Slap instance, connects to server and create
"""Initialize Slap instance, connect to server and create
aliases to common software releases"""
slap
=
slapos
.
slap
.
slap
()
slap
.
initializeConnection
(
config
.
master_url
,
key_file
=
config
.
key_file
,
cert_file
=
config
.
cert_file
)
local
=
globals
().
copy
()
local
[
'slap'
]
=
slap
# Create aliases as global variables
alias
=
config
.
alias
.
split
(
'
\
n
'
)
software_list
=
[]
for
software
in
alias
:
...
...
@@ -103,9 +105,13 @@ def init(config):
name
,
url
=
software
.
split
(
' '
)
software_list
.
append
(
name
)
local
[
name
]
=
url
# Create global variable too see available aliases
local
[
'software_list'
]
=
software_list
# Create global shortcut functions to request instance and software
local
[
'request'
]
=
lambda
software_release
,
reference
:
\
slap
.
registerOpenOrder
().
request
(
software_release
,
reference
)
local
[
'supply'
]
=
lambda
software_release
,
computer
:
\
slap
.
registerSupply
().
supply
(
software_release
,
computer
)
return
local
def
request
():
...
...
@@ -144,7 +150,16 @@ def run():
"""Ran when invoking slapconsole"""
# Parse arguments
usage
=
"""usage: %s [options] CONFIGURATION_FILE
slapconsole allows you interact with slap API."""
%
sys
.
argv
[
0
]
slapconsole allows you interact with slap API. You can play with the global
"slap" object and with the global "request" method.
examples :
>>> # Request instance
>>> request(kvm, "myuniquekvm")
>>> # Request software installation on owned computer
>>> supply(kvm, "mycomputer")
>>> # Fetch instance informations on already launched instance
>>> request(kvm, "myuniquekvm").getConnectionParameter("url")"""
%
sys
.
argv
[
0
]
config
=
Config
()
config
.
setConfig
(
*
Parser
(
usage
=
usage
).
check_args
())
...
...
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