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
Jérome Perrin
slapos.core
Commits
10e1d89c
Commit
10e1d89c
authored
Nov 27, 2014
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos.cli info/list: remove formatters for logger.
Allow to script it.
parent
495599e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
slapos/cli/info.py
slapos/cli/info.py
+11
-0
slapos/cli/list.py
slapos/cli/list.py
+11
-1
No files found.
slapos/cli/info.py
View file @
10e1d89c
...
...
@@ -27,13 +27,23 @@
#
##############################################################################
import
logging
import
pprint
import
sys
from
slapos.cli.config
import
ClientConfigCommand
from
slapos.client
import
init
,
ClientConfig
from
slapos.slap
import
ResourceNotReady
,
NotFoundError
def
resetLogger
(
logger
):
"""Remove all formatters, log files, etc."""
if
not
getattr
(
logger
,
'parent'
,
None
):
return
handler
=
logger
.
parent
.
handlers
[
0
]
logger
.
parent
.
removeHandler
(
handler
)
logger
.
addHandler
(
logging
.
StreamHandler
(
sys
.
stdout
))
class
InfoCommand
(
ClientConfigCommand
):
"""get status, software_release and parameters of an instance"""
...
...
@@ -56,6 +66,7 @@ class InfoCommand(ClientConfigCommand):
def
do_info
(
logger
,
conf
,
local
):
resetLogger
(
logger
)
try
:
instance
=
local
[
'slap'
].
registerOpenOrder
().
getInformation
(
partition_reference
=
conf
.
reference
,
...
...
slapos/cli/list.py
View file @
10e1d89c
...
...
@@ -27,10 +27,19 @@
#
##############################################################################
import
logging
import
sys
from
slapos.cli.config
import
ClientConfigCommand
from
slapos.client
import
init
,
ClientConfig
from
slapos.slap
import
ResourceNotReady
def
resetLogger
(
logger
):
"""Remove all formatters, log files, etc."""
if
not
getattr
(
logger
,
'parent'
,
None
):
return
handler
=
logger
.
parent
.
handlers
[
0
]
logger
.
parent
.
removeHandler
(
handler
)
logger
.
addHandler
(
logging
.
StreamHandler
(
sys
.
stdout
))
class
ListCommand
(
ClientConfigCommand
):
"""request an instance and get status and parameters of instance"""
...
...
@@ -48,6 +57,7 @@ class ListCommand(ClientConfigCommand):
def
do_list
(
logger
,
conf
,
local
):
resetLogger
(
logger
)
# XXX catch exception
instance_dict
=
local
[
'slap'
].
getOpenOrderDict
()
if
instance_dict
==
{}:
...
...
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