Commit 7059917a by Őry Máté

fix style to match pep8

parent c56ff392
...@@ -67,6 +67,7 @@ def linux_set_time(time): ...@@ -67,6 +67,7 @@ def linux_set_time(time):
class Context(object): class Context(object):
@staticmethod @staticmethod
def change_password(password): def change_password(password):
if system == 'Linux': if system == 'Linux':
...@@ -287,7 +288,9 @@ class Context(object): ...@@ -287,7 +288,9 @@ class Context(object):
import notify import notify
notify.notify(msg) notify.notify(msg)
class SerialLineReceiver(SerialLineReceiverBase): class SerialLineReceiver(SerialLineReceiverBase):
def connectionMade(self): def connectionMade(self):
self.send_command( self.send_command(
command='agent_started', command='agent_started',
......
...@@ -5,18 +5,23 @@ ...@@ -5,18 +5,23 @@
# Test program that informs the user about vm incoming time out # Test program that informs the user about vm incoming time out
## ##
import platform, logging, os, subprocess, webbrowser, sys import platform
import logging
import os
import subprocess
import webbrowser
import cPickle as pickle import cPickle as pickle
system = platform.system() system = platform.system()
logger = logging.getLogger() logger = logging.getLogger()
file_name = "vm_renewal.p" file_name = "vm_renewal.p"
def pars_arguments(): def pars_arguments():
import argparse import argparse
parser = argparse.ArgumentParser(); parser = argparse.ArgumentParser()
parser.add_argument("-u", "--url", type=str, required=True) parser.add_argument("-u", "--url", type=str, required=True)
args = parser.parse_args(); args = parser.parse_args()
return args return args
...@@ -31,6 +36,7 @@ def get_temp_dir(): ...@@ -31,6 +36,7 @@ def get_temp_dir():
temp_dir = "/var/tmp" temp_dir = "/var/tmp"
return temp_dir return temp_dir
def wall(text): def wall(text):
if text is None: if text is None:
logger.error("Incorrect function call") logger.error("Incorrect function call")
...@@ -67,6 +73,7 @@ def accept(): ...@@ -67,6 +73,7 @@ def accept():
print "Successfull renewal of this vm!" print "Successfull renewal of this vm!"
os.remove("%s/%s" % (get_temp_dir(), file_name)) os.remove("%s/%s" % (get_temp_dir(), file_name))
def notify(url): def notify(url):
if os.getenv("DISPLAY") and system == 'Linux' or system == 'Windows': if os.getenv("DISPLAY") and system == 'Linux' or system == 'Windows':
webbrowser.open(url, new=2, autoraise=True) webbrowser.open(url, new=2, autoraise=True)
...@@ -74,9 +81,12 @@ def notify(url): ...@@ -74,9 +81,12 @@ def notify(url):
if os.path.isfile("%s/%s" % (get_temp_dir(), file_name)): if os.path.isfile("%s/%s" % (get_temp_dir(), file_name)):
logger.info("There is on old request already saved") logger.info("There is on old request already saved")
pickle.dump(url, open("%s/%s" % (get_temp_dir(), file_name), "wb")) pickle.dump(url, open("%s/%s" % (get_temp_dir(), file_name), "wb"))
wall("This vm is about to time out! Please type vm_renewal command to renew your current process") wall("This virtual machine is going to expire! Please type \n"
" vm_renewal\n"
"command to keep it running.")
else: else:
raise StandardError('Not supported system type') raise Exception('Not supported system type')
def main(): def main():
args = pars_arguments() args = pars_arguments()
......
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