Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
agkyra
Commits
279251f5
Commit
279251f5
authored
Oct 08, 2015
by
Giorgos Korfiatis
Browse files
logger and arg fixes in cli
parent
21a96eb6
Changes
2
Hide whitespace changes
Inline
Side-by-side
agkyra/cli.py
View file @
279251f5
...
...
@@ -19,13 +19,7 @@ import sys
import
logging
import
argparse
try
:
from
agkyra
import
config
except
ImportError
:
sys
.
path
.
insert
(
0
,
"lib"
)
from
agkyra
import
config
from
agkyra
import
protocol
,
protocol_client
,
gui
from
agkyra
import
protocol
,
protocol_client
,
gui
,
config
AGKYRA_DIR
=
config
.
AGKYRA_DIR
...
...
@@ -44,7 +38,7 @@ NOTIFICATION = protocol.COMMON['NOTIFICATION']
remaining
=
lambda
st
:
st
[
'unsynced'
]
-
(
st
[
'synced'
]
+
st
[
'failed'
])
class
ConfigCommands
:
class
ConfigCommands
(
object
)
:
"""Commands for handling Agkyra config options"""
cnf
=
config
.
AgkyraConfig
()
...
...
@@ -130,7 +124,8 @@ class AgkyraCLI(cmd.Cmd):
def
__init__
(
self
,
*
args
,
**
kwargs
):
self
.
callback
=
kwargs
.
pop
(
'callback'
,
sys
.
argv
[
0
])
self
.
args
=
kwargs
.
pop
(
'parsed_args'
,
None
)
LOGGER
.
setLevel
(
logging
.
DEBUG
if
self
.
args
.
debug
else
logging
.
INFO
)
AGKYRA_LOGGER
.
setLevel
(
logging
.
DEBUG
if
self
.
args
.
debug
else
logging
.
INFO
)
cmd
.
Cmd
.
__init__
(
self
,
*
args
,
**
kwargs
)
@
staticmethod
...
...
@@ -166,13 +161,13 @@ class AgkyraCLI(cmd.Cmd):
def
launch_daemon
(
self
):
"""Launch the agkyra protocol server"""
LOGGER
.
debug
(
'Start the
session helper
'
)
LOGGER
.
info
(
'Start
ing
the
agkyra daemon
'
)
if
not
self
.
helper
.
load_active_session
():
self
.
helper
.
create_session
()
self
.
helper
.
start
()
LOGGER
.
info
(
'Daemon is shut down'
)
else
:
LOGGER
.
info
(
'Another session is running, aborting'
)
LOGGER
.
debug
(
'Session Helper is now down'
)
LOGGER
.
info
(
'Another daemon is running, aborting'
)
@
property
def
client
(
self
):
...
...
@@ -311,6 +306,10 @@ class AgkyraCLI(cmd.Cmd):
return
if
line
in
[
'daemon'
]:
return
self
.
launch_daemon
()
if
line
:
sys
.
stderr
.
write
(
"Unrecognized subcommand '%s'.
\n
"
%
line
)
sys
.
stderr
.
flush
()
return
client
=
self
.
client
if
not
client
:
sys
.
stderr
.
write
(
'No Agkyra daemons running, starting one'
)
...
...
agkyra/scripts/agkyra
View file @
279251f5
...
...
@@ -27,9 +27,6 @@ except ImportError:
from
agkyra.cli
import
AgkyraCLI
CALLBACK
=
os
.
path
.
realpath
(
sys
.
argv
[
0
])
if
__name__
==
"__main__"
:
args
=
AgkyraCLI
.
parse_args
()
agkcli
=
AgkyraCLI
(
parsed_args
=
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