Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
agentdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
48f8974e
authored
Jun 25, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add renew task
parent
93d7fdc0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
agentcelery.py
+5
-0
protocol.py
+6
-3
No files found.
agentcelery.py
View file @
48f8974e
...
@@ -108,6 +108,11 @@ def send_notification(vm, msg):
...
@@ -108,6 +108,11 @@ def send_notification(vm, msg):
command
=
'send_notification'
,
args
=
{
'msg'
:
msg
})
command
=
'send_notification'
,
args
=
{
'msg'
:
msg
})
@celery.task
(
name
=
'vm.tasks.local_agent_tasks.renew'
)
def
renew
(
vm
):
print
vm
@celery.task
(
name
=
'vm.tasks.local_agent_tasks.agent_started'
)
@celery.task
(
name
=
'vm.tasks.local_agent_tasks.agent_started'
)
def
agent_started
(
vm
):
def
agent_started
(
vm
):
print
vm
print
vm
...
...
protocol.py
View file @
48f8974e
...
@@ -11,7 +11,7 @@ from celery.result import TimeoutError
...
@@ -11,7 +11,7 @@ from celery.result import TimeoutError
from
utils
import
SerialLineReceiverBase
from
utils
import
SerialLineReceiverBase
from
agentcelery
import
agent_started
,
agent_stopped
from
agentcelery
import
agent_started
,
agent_stopped
,
renew
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -63,11 +63,14 @@ class SerialLineReceiver(SerialLineReceiverBase):
...
@@ -63,11 +63,14 @@ class SerialLineReceiver(SerialLineReceiverBase):
if
command
==
'agent_stopped'
:
if
command
==
'agent_stopped'
:
agent_stopped
.
apply_async
(
queue
=
'localhost.man'
,
agent_stopped
.
apply_async
(
queue
=
'localhost.man'
,
args
=
(
self
.
factory
.
vm
,
))
args
=
(
self
.
factory
.
vm
,
))
if
command
==
'agent_started'
:
el
if
command
==
'agent_started'
:
version
=
args
.
get
(
'version'
,
None
)
version
=
args
.
get
(
'version'
,
None
)
agent_started
.
apply_async
(
queue
=
'localhost.man'
,
agent_started
.
apply_async
(
queue
=
'localhost.man'
,
args
=
(
self
.
factory
.
vm
,
version
))
args
=
(
self
.
factory
.
vm
,
version
))
if
command
==
'ping'
:
elif
command
==
'renew'
:
renew
.
apply_async
(
queue
=
'localhost.man'
,
args
=
(
self
.
factory
.
vm
,
))
elif
command
==
'ping'
:
self
.
send_response
(
response
=
'pong'
,
self
.
send_response
(
response
=
'pong'
,
args
=
args
)
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