Commit 01cb1ab2 by Czémán Arnold

Fix "Unhandles exception (_linux_set_time)" bug. Issue: #15

Plus correct flake8 errors.
parent 7f3d854d
#!/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()
......
...@@ -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
......
...@@ -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')
......
#!/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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment