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
Nicolas Wavrant
slapos.core
Commits
0beb316f
Commit
0beb316f
authored
Sep 15, 2014
by
Kazuhiko Shiozaki
Committed by
Rafael Monnerat
Nov 10, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos: cleanup cliff import.
parent
bdb68768
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
slapos/cli/entry.py
slapos/cli/entry.py
+10
-16
No files found.
slapos/cli/entry.py
View file @
0beb316f
...
...
@@ -39,14 +39,8 @@ import os
# must be done before importing cliff
os
.
environ
.
setdefault
(
'EDITOR'
,
'vi'
)
import
cliff
import
cliff.app
try
:
LOG
=
cliff
.
app
.
App
.
LOG
except
AttributeError
:
# Support for older (< 1.7.0) cliff versions
from
cliff.app
import
LOG
import
cliff.commandmanager
from
cliff.app
import
App
from
cliff.commandmanager
import
CommandManager
,
LOG
import
slapos.version
...
...
@@ -55,7 +49,7 @@ urllib3_logger = logging.getLogger('requests.packages.urllib3')
urllib3_logger
.
setLevel
(
logging
.
WARNING
)
class
SlapOSCommandManager
(
cliff
.
commandmanager
.
CommandManager
):
class
SlapOSCommandManager
(
CommandManager
):
def
find_command
(
self
,
argv
):
"""Given an argument list, find a command and
...
...
@@ -124,7 +118,7 @@ class SlapOSHelpAction(argparse.Action):
return
group
,
' %-13s %s
\
n
'
%
(
name
,
one_liner
)
class
SlapOSApp
(
cliff
.
app
.
App
):
class
SlapOSApp
(
App
):
#
# self.options.verbose_level:
...
...
@@ -205,7 +199,7 @@ class SlapOSApp(cliff.app.App):
self
.
log
.
debug
(
'clean_up %s'
,
cmd
.
__class__
.
__name__
)
def
run
(
self
,
argv
):
# same as cliff.App.run except that it won't re-raise
# same as cliff.
app.
App.run except that it won't re-raise
# a logged exception, and doesn't use --debug
self
.
options
,
remainder
=
self
.
parser
.
parse_known_args
(
argv
)
self
.
configure_logging
()
...
...
@@ -213,7 +207,7 @@ class SlapOSApp(cliff.app.App):
try
:
self
.
initialize_app
(
remainder
)
except
Exception
as
err
:
LOG
.
exception
(
err
)
self
.
log
.
exception
(
err
)
return
1
if
self
.
interactive_mode
:
result
=
self
.
interact
()
...
...
@@ -222,7 +216,7 @@ class SlapOSApp(cliff.app.App):
return
result
def
run_subcommand
(
self
,
argv
):
# same as cliff.App.run_subcommand except that it won't re-raise
# same as cliff.
app.
App.run_subcommand except that it won't re-raise
# a logged exception, and doesn't use --debug
subcommand
=
self
.
command_manager
.
find_command
(
argv
)
cmd_factory
,
cmd_name
,
sub_argv
=
subcommand
...
...
@@ -239,16 +233,16 @@ class SlapOSApp(cliff.app.App):
parsed_args
=
cmd_parser
.
parse_args
(
sub_argv
)
result
=
cmd
.
run
(
parsed_args
)
except
Exception
as
err
:
LOG
.
exception
(
err
)
self
.
log
.
exception
(
err
)
try
:
self
.
clean_up
(
cmd
,
result
,
err
)
except
Exception
as
err2
:
LOG
.
exception
(
err2
)
self
.
log
.
exception
(
err2
)
else
:
try
:
self
.
clean_up
(
cmd
,
result
,
None
)
except
Exception
as
err3
:
LOG
.
exception
(
err3
)
self
.
log
.
exception
(
err3
)
return
result
...
...
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