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
a225fb3a
authored
Oct 12, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add missing agent.update code
parent
89e2fcba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
agentcelery.py
+19
-5
protocol.py
+3
-1
No files found.
agentcelery.py
View file @
a225fb3a
...
@@ -25,7 +25,7 @@ celery.conf.update(CELERY_CACHE_BACKEND=CACHE_URI,
...
@@ -25,7 +25,7 @@ celery.conf.update(CELERY_CACHE_BACKEND=CACHE_URI,
def
send_command
(
vm
,
command
,
*
args
,
**
kwargs
):
def
send_command
(
vm
,
command
,
*
args
,
**
kwargs
):
uuid
=
kwargs
.
get
(
'uuid'
,
None
)
uuid
=
kwargs
.
get
(
'uuid'
,
None
)
timeout
=
kwargs
.
get
(
'timeout'
,
10
)
timeout
=
kwargs
.
get
(
'timeout'
,
58
)
if
uuid
:
if
uuid
:
event
=
Event
()
event
=
Event
()
reactor
.
running_tasks
[
vm
][
uuid
]
=
event
reactor
.
running_tasks
[
vm
][
uuid
]
=
event
...
@@ -85,11 +85,25 @@ def start_access_server(vm):
...
@@ -85,11 +85,25 @@ def start_access_server(vm):
send_command
(
vm
,
command
=
'start_access_server'
)
send_command
(
vm
,
command
=
'start_access_server'
)
@celery.task
(
name
=
'agent.append'
)
def
append
(
vm
,
data
,
filename
,
chunk_number
):
kwargs
=
{
'command'
:
'append'
,
'data'
:
data
,
'chunk_number'
:
chunk_number
,
'filename'
:
filename
,
'uuid'
:
append
.
request
.
id
}
return
send_command
(
vm
,
**
kwargs
)
@celery.task
(
name
=
'agent.update_legacy'
)
def
update_legacy
(
vm
,
data
):
kwargs
=
{
'command'
:
'update'
,
'uuid'
:
update_legacy
.
request
.
id
,
'data'
:
data
}
return
send_command
(
vm
,
**
kwargs
)
@celery.task
(
name
=
'agent.update'
)
@celery.task
(
name
=
'agent.update'
)
def
update
(
vm
,
data
,
executable
=
None
):
def
update
(
vm
,
filename
,
executable
,
checksum
):
kwargs
=
{
'command'
:
'update'
,
'
data'
:
data
,
'uuid'
:
update
.
request
.
id
}
kwargs
=
{
'command'
:
'update'
,
'
uuid'
:
update
.
request
.
id
,
if
executable
is
not
None
:
'filename'
:
filename
,
'checksum'
:
checksum
,
kwargs
[
'executable'
]
=
executable
'executable'
:
executable
}
return
send_command
(
vm
,
**
kwargs
)
return
send_command
(
vm
,
**
kwargs
)
...
...
protocol.py
View file @
a225fb3a
...
@@ -33,6 +33,7 @@ class GraphiteClientProtocol(protocol.Protocol):
...
@@ -33,6 +33,7 @@ class GraphiteClientProtocol(protocol.Protocol):
self
.
transport
.
write
(
message
)
self
.
transport
.
write
(
message
)
self
.
transport
.
loseConnection
()
self
.
transport
.
loseConnection
()
logger
.
debug
(
's:
%
s'
%
self
.
data
)
logger
.
debug
(
's:
%
s'
%
self
.
data
)
logger
.
info
(
"Monitor info from:
%
s"
,
self
.
name
)
class
GraphiteClientFactory
(
protocol
.
ClientFactory
):
class
GraphiteClientFactory
(
protocol
.
ClientFactory
):
...
@@ -65,8 +66,9 @@ class SerialLineReceiver(SerialLineReceiverBase):
...
@@ -65,8 +66,9 @@ class SerialLineReceiver(SerialLineReceiverBase):
args
=
(
self
.
factory
.
vm
,
))
args
=
(
self
.
factory
.
vm
,
))
elif
command
==
'agent_started'
:
elif
command
==
'agent_started'
:
version
=
args
.
get
(
'version'
,
None
)
version
=
args
.
get
(
'version'
,
None
)
system
=
args
.
get
(
'system'
,
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
,
system
))
elif
command
==
'renew'
:
elif
command
==
'renew'
:
renew
.
apply_async
(
queue
=
'localhost.man'
,
renew
.
apply_async
(
queue
=
'localhost.man'
,
args
=
(
self
.
factory
.
vm
,
))
args
=
(
self
.
factory
.
vm
,
))
...
...
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