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
Léo-Paul Géneau
slapos.core
Commits
f51f1b48
Commit
f51f1b48
authored
Jun 26, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
console: ipython support
parent
845e7fb6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
setup.py
setup.py
+1
-0
slapos/cli/console.py
slapos/cli/console.py
+26
-1
No files found.
setup.py
View file @
f51f1b48
...
@@ -46,6 +46,7 @@ setup(name=name,
...
@@ -46,6 +46,7 @@ setup(name=name,
'zc.buildout'
,
'zc.buildout'
,
'cliff'
,
'cliff'
,
'requests'
,
'requests'
,
'ipython'
,
]
+
additional_install_requires
,
]
+
additional_install_requires
,
extra_requires
=
{
'docs'
:
(
extra_requires
=
{
'docs'
:
(
'Sphinx'
,
'Sphinx'
,
...
...
slapos/cli/console.py
View file @
f51f1b48
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
textwrap
from
slapos.cli.config
import
ClientConfigCommand
from
slapos.cli.config
import
ClientConfigCommand
from
slapos.client
import
init
,
do_console
,
ClientConfig
from
slapos.client
import
init
,
do_console
,
ClientConfig
...
@@ -38,4 +40,27 @@ class ConsoleCommand(ClientConfigCommand):
...
@@ -38,4 +40,27 @@ class ConsoleCommand(ClientConfigCommand):
configp
=
self
.
fetch_config
(
args
)
configp
=
self
.
fetch_config
(
args
)
conf
=
ClientConfig
(
args
,
configp
)
conf
=
ClientConfig
(
args
,
configp
)
local
=
init
(
conf
)
local
=
init
(
conf
)
try
:
import
IPython
do_ipython_console
(
local
)
except
ImportError
:
do_console
(
local
)
do_console
(
local
)
def
do_ipython_console
(
local
):
from
IPython
import
embed
embed
(
banner1
=
textwrap
.
dedent
(
"""
\
slapos console allows you interact with slap API. You can play with the global
"slap" object and with the global request() and supply() methods.
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")
"""
),
#exit_msg='BYE.',
user_ns
=
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