Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
agentdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
1
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
349c54c9
authored
Jun 23, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix debug lines
parent
72fb083e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
24 deletions
+11
-24
agentcelery.py
+11
-24
No files found.
agentcelery.py
View file @
349c54c9
...
@@ -26,7 +26,7 @@ def change_password(vm, password):
...
@@ -26,7 +26,7 @@ def change_password(vm, password):
reactor
.
connections
[
vm
]
.
send_command
(
command
=
'change_password'
,
reactor
.
connections
[
vm
]
.
send_command
(
command
=
'change_password'
,
args
=
{
'password'
:
args
=
{
'password'
:
password
})
password
})
logger
.
debug
(
'change_password(
%
s,
%
s)'
%
(
vm
,
password
)
)
logger
.
debug
(
'change_password(
%
s,
%
s)'
,
vm
,
password
)
@celery.task
(
name
=
'agent.set_hostname'
)
@celery.task
(
name
=
'agent.set_hostname'
)
...
@@ -34,21 +34,21 @@ def set_hostname(vm, hostname):
...
@@ -34,21 +34,21 @@ def set_hostname(vm, hostname):
reactor
.
connections
[
vm
]
.
send_command
(
command
=
'set_hostname'
,
reactor
.
connections
[
vm
]
.
send_command
(
command
=
'set_hostname'
,
args
=
{
'hostname'
:
args
=
{
'hostname'
:
hostname
})
hostname
})
logger
.
debug
(
'set_hostname(
%
s,
%
s)'
%
(
vm
,
hostname
)
)
logger
.
debug
(
'set_hostname(
%
s,
%
s)'
,
vm
,
hostname
)
@celery.task
(
name
=
'agent.restart_networking'
)
@celery.task
(
name
=
'agent.restart_networking'
)
def
restart_networking
(
vm
):
def
restart_networking
(
vm
):
reactor
.
connections
[
vm
]
.
send_command
(
command
=
'restart_networking'
,
reactor
.
connections
[
vm
]
.
send_command
(
command
=
'restart_networking'
,
args
=
{})
args
=
{})
logger
.
debug
(
'restart_networking(
%
s)'
%
(
vm
)
)
logger
.
debug
(
'restart_networking(
%
s)'
,
vm
)
@celery.task
(
name
=
'agent.set_time'
)
@celery.task
(
name
=
'agent.set_time'
)
def
set_time
(
vm
,
time
):
def
set_time
(
vm
,
time
):
reactor
.
connections
[
vm
]
.
send_command
(
command
=
'set_time'
,
reactor
.
connections
[
vm
]
.
send_command
(
command
=
'set_time'
,
args
=
{
'time'
:
time
})
args
=
{
'time'
:
time
})
logger
.
debug
(
'set_time(
%
s,
%
s)'
%
(
vm
,
time
)
)
logger
.
debug
(
'set_time(
%
s,
%
s)'
,
vm
,
time
)
@celery.task
(
name
=
'agent.mount_store'
)
@celery.task
(
name
=
'agent.mount_store'
)
...
@@ -57,46 +57,46 @@ def mount_store(vm, host, username, password):
...
@@ -57,46 +57,46 @@ def mount_store(vm, host, username, password):
args
=
{
'host'
:
host
,
args
=
{
'host'
:
host
,
'username'
:
username
,
'username'
:
username
,
'password'
:
password
})
'password'
:
password
})
logger
.
debug
(
'mount_store(
%
s,
%
s,
%
s)'
%
(
vm
,
host
,
username
)
)
logger
.
debug
(
'mount_store(
%
s,
%
s,
%
s)'
,
vm
,
host
,
username
)
@celery.task
(
name
=
'agent.cleanup'
)
@celery.task
(
name
=
'agent.cleanup'
)
def
cleanup
(
vm
):
def
cleanup
(
vm
):
reactor
.
connections
[
vm
]
.
send_command
(
command
=
'cleanup'
,
args
=
{})
reactor
.
connections
[
vm
]
.
send_command
(
command
=
'cleanup'
,
args
=
{})
logger
.
debug
(
'cleanup(
%
s)'
%
vm
)
logger
.
debug
(
'cleanup(
%
s)'
,
vm
)
@celery.task
(
name
=
'agent.start_access_server'
)
@celery.task
(
name
=
'agent.start_access_server'
)
def
start_access_server
(
vm
):
def
start_access_server
(
vm
):
reactor
.
connections
[
vm
]
.
send_command
(
reactor
.
connections
[
vm
]
.
send_command
(
command
=
'start_access_server'
,
args
=
{})
command
=
'start_access_server'
,
args
=
{})
logger
.
debug
(
'start_access_server(
%
s)'
%
vm
)
logger
.
debug
(
'start_access_server(
%
s)'
,
vm
)
@celery.task
(
name
=
'agent.update'
)
@celery.task
(
name
=
'agent.update'
)
def
update
(
vm
,
data
):
def
update
(
vm
,
data
):
logger
.
debug
(
'update(
%
s)'
%
vm
)
logger
.
debug
(
'update(
%
s)'
,
vm
)
return
reactor
.
connections
[
vm
]
.
send_command
(
return
reactor
.
connections
[
vm
]
.
send_command
(
command
=
'update'
,
args
=
{
'data'
:
data
},
uuid
=
update
.
request
.
id
)
command
=
'update'
,
args
=
{
'data'
:
data
},
uuid
=
update
.
request
.
id
)
@celery.task
(
name
=
'agent.add_keys'
)
@celery.task
(
name
=
'agent.add_keys'
)
def
add_keys
(
vm
,
keys
):
def
add_keys
(
vm
,
keys
):
logger
.
debug
(
'add_keys(
%
s
)'
%
keys
)
logger
.
debug
(
'add_keys(
%
s
%
s)'
,
vm
,
keys
)
reactor
.
connections
[
vm
]
.
send_command
(
reactor
.
connections
[
vm
]
.
send_command
(
command
=
'add_keys'
,
args
=
{
'keys'
:
keys
})
command
=
'add_keys'
,
args
=
{
'keys'
:
keys
})
@celery.task
(
name
=
'agent.del_keys'
)
@celery.task
(
name
=
'agent.del_keys'
)
def
del_keys
(
vm
,
keys
):
def
del_keys
(
vm
,
keys
):
logger
.
debug
(
'del_keys(
%
s
)'
%
keys
)
logger
.
debug
(
'del_keys(
%
s
,
%
s)'
,
vm
,
keys
)
reactor
.
connections
[
vm
]
.
send_command
(
reactor
.
connections
[
vm
]
.
send_command
(
command
=
'del_keys'
,
args
=
{
'keys'
:
keys
})
command
=
'del_keys'
,
args
=
{
'keys'
:
keys
})
@celery.task
(
name
=
'agent.get_keys'
)
@celery.task
(
name
=
'agent.get_keys'
)
def
get_keys
(
vm
):
def
get_keys
(
vm
):
logger
.
debug
(
'get_keys(
)'
)
logger
.
debug
(
'get_keys(
%
s)'
,
vm
)
return
reactor
.
connections
[
vm
]
.
send_command
(
return
reactor
.
connections
[
vm
]
.
send_command
(
command
=
'get_keys'
,
args
=
{},
uuid
=
get_keys
.
request
.
id
)
command
=
'get_keys'
,
args
=
{},
uuid
=
get_keys
.
request
.
id
)
...
@@ -114,16 +114,3 @@ def agent_stopped(vm):
...
@@ -114,16 +114,3 @@ def agent_stopped(vm):
@celery.task
(
name
=
'vm.tasks.local_agent_tasks.agent_ok'
)
@celery.task
(
name
=
'vm.tasks.local_agent_tasks.agent_ok'
)
def
agent_ok
(
vm
):
def
agent_ok
(
vm
):
print
vm
print
vm
# class StartProcTask(celery.Task):
# def run(self):
# print 'HELLO'*10
# self.app.proc = WCProcessProtocol('testing')
# self.app.proc._waiting['startup'] = Deferred()
# def lofasz(asd):
# print 'ezjott%s' % asd
# self.app.proc._waiting['startup'].addCallback(lofasz)
# threads.blockingCallFromThread(reactor, reactor.spawnProcess,
# self.app.proc, 'ls', ['ls'])
# return True
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