Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
agentdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e957e6a5
authored
Jan 07, 2022
by
Kohl Krisztofer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First 3.6 version
parent
f859b4cc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
18 deletions
+18
-18
agentcelery.py
+7
-7
agentdriver.py
+1
-1
miscellaneous/agentdriver.conf
+3
-3
protocol.py
+2
-2
requirements.txt
+3
-3
utils.py
+2
-2
No files found.
agentcelery.py
View file @
e957e6a5
...
...
@@ -14,8 +14,8 @@ HOSTNAME = gethostname().split('.')[0]
AMQP_URI
=
getenv
(
'AMQP_URI'
)
celery
=
Celery
(
'agent'
,
broker
=
AMQP_URI
)
celery
.
conf
.
update
(
CELERY_RESULT_BACKEND
=
'amqp'
,
CELERY_TASK_RESULT_EXPIRES
=
300
,
celery
.
conf
.
update
(
CELERY_RESULT_BACKEND
=
'amqp
://
'
,
CELERY_TASK_RESULT_EXPIRES
=
300
00
,
CELERY_QUEUES
=
(
Queue
(
HOSTNAME
+
'.agent'
,
Exchange
(
'agent'
,
type
=
'direct'
),
routing_key
=
'agent'
),
))
...
...
@@ -33,7 +33,7 @@ def send_command(vm, command, *args, **kwargs):
if
command
==
'append'
and
'vio-cloud'
not
in
conn
.
transport
.
addr
:
continue
logger
.
info
(
'
%
s(
%
s,
%
s)'
,
command
,
vm
,
', '
.
join
(
map
(
lambda
x
:
str
(
x
)[:
100
],
kwargs
.
values
())
))
', '
.
join
(
[
str
(
x
)[:
100
]
for
x
in
list
(
kwargs
.
values
())]
))
conn
.
send_command
(
command
=
command
,
args
=
kwargs
)
if
uuid
:
...
...
@@ -135,19 +135,19 @@ def change_ip(vm, interfaces, dns):
@celery.task
(
name
=
'vm.tasks.local_agent_tasks.renew'
)
def
renew
(
vm
):
print
vm
print
(
vm
)
@celery.task
(
name
=
'vm.tasks.local_agent_tasks.agent_started'
)
def
agent_started
(
vm
):
print
vm
print
(
vm
)
@celery.task
(
name
=
'vm.tasks.local_agent_tasks.agent_stopped'
)
def
agent_stopped
(
vm
):
print
vm
print
(
vm
)
@celery.task
(
name
=
'vm.tasks.local_agent_tasks.agent_ok'
)
def
agent_ok
(
vm
):
print
vm
print
(
vm
)
agentdriver.py
View file @
e957e6a5
...
...
@@ -13,7 +13,7 @@ level = environ.get('LOGLEVEL', 'INFO')
logger
.
setLevel
(
level
)
SOCKET_DIR
=
getenv
(
'SOCKET_DIR'
,
'/var/lib/libvirt/
serial
'
)
SOCKET_DIR
=
getenv
(
'SOCKET_DIR'
,
'/var/lib/libvirt/'
)
old_install_platform_tweaks
=
Worker
.
install_platform_tweaks
...
...
miscellaneous/agentdriver.conf
View file @
e957e6a5
...
...
@@ -10,8 +10,8 @@ setuid cloud
script
cd
/
home
/
cloud
/
agentdriver
. /
home
/
cloud
/.
virtualenvs
/
agentdriver
/
local
/
bin
/
activate
. /
home
/
cloud
/.
virtualenvs
/
agentdriver
/
local
/
bin
/
postactivate
cd
/
home
/
kohlkriszto
/
Documents
/
agentdriver
. /
home
/
kohlkriszto
/
Documents
/
agentdriver_venv
/
bin
/
activate
. /
home
/
kohlkriszto
/
Documents
/
agentdriver_venv
/
bin
/
postactivate
python
agentdriver
.
py
end
script
protocol.py
View file @
e957e6a5
...
...
@@ -20,10 +20,10 @@ class GraphiteClientProtocol(protocol.Protocol):
def
connectionMade
(
self
):
timestamp
=
time
.
time
()
data_list
=
[]
for
key
,
value
in
self
.
data
.
items
(
):
for
key
,
value
in
list
(
self
.
data
.
items
()
):
if
not
isinstance
(
value
,
dict
):
continue
for
k
,
v
in
value
.
items
(
):
for
k
,
v
in
list
(
value
.
items
()
):
data_list
.
append
((
'agent.
%
s.
%
s.
%
s'
%
(
self
.
name
,
key
,
k
),
(
timestamp
,
float
(
v
))))
...
...
requirements.txt
View file @
e957e6a5
celery
==3.1.17
Twisted
==13.1.0
threadpool
==1.2.7
celery
Twisted
threadpool
utils.py
View file @
e957e6a5
...
...
@@ -37,9 +37,9 @@ class SerialLineReceiverBase(LineReceiver, object):
logger
.
error
(
'[serial] invalid json:
%
s (
%
s)'
%
(
data
,
e
))
return
if
command
is
not
None
and
isinstance
(
command
,
unicode
):
if
command
is
not
None
and
isinstance
(
command
,
str
):
logger
.
debug
(
'received command:
%
s (
%
s)'
%
(
command
,
args
))
self
.
handle_command
(
command
,
args
)
elif
response
is
not
None
and
isinstance
(
response
,
unicode
):
elif
response
is
not
None
and
isinstance
(
response
,
str
):
logger
.
debug
(
'received reply:
%
s (
%
s)'
%
(
response
,
args
))
self
.
handle_response
(
response
,
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