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
01cb1ab2
authored
Feb 22, 2016
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix "Unhandles exception (_linux_set_time)" bug. Issue:
#15
Plus correct flake8 errors.
parent
7f3d854d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
9 deletions
+11
-9
agent.py
+3
-1
linux/_linuxcontext.py
+4
-3
linux/ssh.py
+2
-3
windows/_win32context.py
+2
-2
No files found.
agent.py
View file @
01cb1ab2
#!/usr/bin/env python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# flake8: noqa ignore=E402
from
os
import
environ
,
chdir
from
os
import
environ
,
chdir
import
platform
import
platform
import
subprocess
import
subprocess
import
sys
import
sys
system
=
platform
.
system
()
system
=
platform
.
system
()
if
system
==
"Linux"
:
if
system
==
"Linux"
:
...
@@ -19,7 +21,6 @@ if system == "Linux":
...
@@ -19,7 +21,6 @@ if system == "Linux":
from
twisted.internet
import
reactor
,
defer
from
twisted.internet
import
reactor
,
defer
from
twisted.internet.task
import
LoopingCall
from
twisted.internet.task
import
LoopingCall
import
uptime
import
uptime
import
logging
import
logging
from
inspect
import
getargspec
,
isfunction
from
inspect
import
getargspec
,
isfunction
...
@@ -30,6 +31,7 @@ from utils import SerialLineReceiverBase
...
@@ -30,6 +31,7 @@ from utils import SerialLineReceiverBase
# (relative import error.
# (relative import error.
from
context
import
BaseContext
,
get_context
,
get_serial
# noqa
from
context
import
BaseContext
,
get_context
,
get_serial
# noqa
Context
=
get_context
()
Context
=
get_context
()
logging
.
basicConfig
()
logging
.
basicConfig
()
...
...
linux/_linuxcontext.py
View file @
01cb1ab2
...
@@ -8,8 +8,6 @@ from shutil import rmtree, move
...
@@ -8,8 +8,6 @@ from shutil import rmtree, move
import
subprocess
import
subprocess
import
sys
import
sys
working_directory
=
sys
.
path
[
0
]
import
logging
import
logging
import
fileinput
import
fileinput
import
tarfile
import
tarfile
...
@@ -19,13 +17,15 @@ from StringIO import StringIO
...
@@ -19,13 +17,15 @@ from StringIO import StringIO
from
base64
import
decodestring
from
base64
import
decodestring
from
hashlib
import
md5
from
hashlib
import
md5
from
ssh
import
PubKey
from
ssh
import
PubKey
from
.network
import
change_ip_ubuntu
,
change_ip_rhel
from
.network
import
change_ip_ubuntu
,
change_ip_rhel
from
context
import
BaseContext
from
context
import
BaseContext
from
twisted.internet
import
reactor
from
twisted.internet
import
reactor
working_directory
=
sys
.
path
[
0
]
logger
=
logging
.
getLogger
()
logger
=
logging
.
getLogger
()
SSH_DIR
=
expanduser
(
'~cloud/.ssh'
)
SSH_DIR
=
expanduser
(
'~cloud/.ssh'
)
...
@@ -51,6 +51,7 @@ class Context(BaseContext):
...
@@ -51,6 +51,7 @@ class Context(BaseContext):
# http://stackoverflow.com/questions/12081310/
# http://stackoverflow.com/questions/12081310/
# python-module-to-change-system-date-and-time
# python-module-to-change-system-date-and-time
@staticmethod
def
_linux_set_time
(
time
):
def
_linux_set_time
(
time
):
import
ctypes
import
ctypes
import
ctypes.util
import
ctypes.util
...
...
linux/ssh.py
View file @
01cb1ab2
...
@@ -2,6 +2,8 @@ from base64 import decodestring
...
@@ -2,6 +2,8 @@ from base64 import decodestring
from
struct
import
unpack
from
struct
import
unpack
import
binascii
import
binascii
import
unittest
class
InvalidKeyType
(
Exception
):
class
InvalidKeyType
(
Exception
):
pass
pass
...
@@ -56,9 +58,6 @@ class PubKey(object):
...
@@ -56,9 +58,6 @@ class PubKey(object):
return
u'<PubKey:
%
s>'
%
unicode
(
self
)
return
u'<PubKey:
%
s>'
%
unicode
(
self
)
import
unittest
class
SshTestCase
(
unittest
.
TestCase
):
class
SshTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
p1
=
PubKey
.
from_str
(
'ssh-rsa AAAAB3NzaC1yc2EA comment'
)
self
.
p1
=
PubKey
.
from_str
(
'ssh-rsa AAAAB3NzaC1yc2EA comment'
)
...
...
windows/_win32context.py
View file @
01cb1ab2
#!/usr/bin/env python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
working_directory
=
r"C:\circle"
from
os.path
import
join
from
os.path
import
join
import
logging
import
logging
...
@@ -21,6 +19,8 @@ from .network import change_ip_windows
...
@@ -21,6 +19,8 @@ from .network import change_ip_windows
from
context
import
BaseContext
from
context
import
BaseContext
working_directory
=
r"C:\circle"
logger
=
logging
.
getLogger
()
logger
=
logging
.
getLogger
()
...
...
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