Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
agent
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
7
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6a0ff254
authored
Sep 05, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy vm_renewal when starting instead of at update
parent
13e51a58
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
agent.py
+11
-7
No files found.
agent.py
View file @
6a0ff254
...
...
@@ -2,11 +2,19 @@
# -*- coding: utf-8 -*-
from
os
import
mkdir
,
environ
,
chdir
import
platform
from
shutil
import
copy
import
subprocess
import
sys
chdir
(
sys
.
path
[
0
])
subprocess
.
call
((
'pip'
,
'install'
,
'-r'
,
'requirements.txt'
))
try
:
chdir
(
sys
.
path
[
0
])
subprocess
.
call
((
'pip'
,
'install'
,
'-r'
,
'requirements.txt'
))
system
=
platform
.
system
()
if
system
==
'Linux'
:
copy
(
"/root/agent/misc/vm_renewal"
,
"/usr/local/bin/"
)
except
:
pass
# hope it works
from
twisted.internet
import
reactor
,
defer
...
...
@@ -16,14 +24,13 @@ from twisted.internet.serialport import SerialPort
import
uptime
import
logging
import
fileinput
import
platform
import
tarfile
from
os.path
import
expanduser
,
join
,
exists
from
glob
import
glob
from
inspect
import
getargspec
,
isfunction
from
StringIO
import
StringIO
from
base64
import
decodestring
from
shutil
import
rmtree
,
move
,
copy
from
shutil
import
rmtree
,
move
from
datetime
import
datetime
from
utils
import
SerialLineReceiverBase
...
...
@@ -48,7 +55,6 @@ mount_template_linux = (
',password=
%(password)
s,iocharset=utf8,uid=cloud 0 0
\n
'
)
system
=
platform
.
system
()
distros
=
{
'Scientific Linux'
:
'rhel'
,
'CentOS'
:
'rhel'
,
'CentOS Linux'
:
'rhel'
,
...
...
@@ -273,8 +279,6 @@ class Context(object):
rmtree
(
old_dir
,
ignore_errors
=
True
)
move
(
cur_dir
,
old_dir
)
move
(
new_dir
,
cur_dir
)
if
system
==
'Linux'
:
copy
(
"/root/agent/misc/vm_renewal"
,
"/usr/local/bin/"
)
logger
.
info
(
'Updated'
)
reactor
.
stop
()
...
...
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