1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-13 20:08:55 +00:00

Yet another PEP 8 :)

This commit is contained in:
Julien Duponchelle 2015-01-20 16:37:18 +01:00
parent 7cf409c392
commit bbee5f90a0
106 changed files with 9 additions and 29 deletions

View File

@ -52,7 +52,7 @@ class Rackspace(object):
self.authenticated = self.rksp.authenticate() self.authenticated = self.rksp.authenticate()
def _find_my_instance(self): def _find_my_instance(self):
if self.authenticated == False: if self.authenticated is not False:
log.critical("Not authenticated against rackspace!!!!") log.critical("Not authenticated against rackspace!!!!")
for region in self.rksp.list_regions(): for region in self.rksp.list_regions():

View File

@ -33,13 +33,11 @@ class BaseVM:
# TODO: When delete release console ports # TODO: When delete release console ports
@property @property
def project(self): def project(self):
"""Return VM current project""" """Return VM current project"""
return self._project return self._project
@property @property
def name(self): def name(self):
""" """
@ -50,7 +48,6 @@ class BaseVM:
return self._name return self._name
@name.setter @name.setter
def name(self, new_name): def name(self, new_name):
""" """
@ -61,7 +58,6 @@ class BaseVM:
self._name = new_name self._name = new_name
@property @property
def uuid(self): def uuid(self):
""" """
@ -72,7 +68,6 @@ class BaseVM:
return self._uuid return self._uuid
@property @property
def manager(self): def manager(self):
""" """
@ -83,7 +78,6 @@ class BaseVM:
return self._manager return self._manager
@property @property
def working_dir(self): def working_dir(self):
""" """
@ -92,7 +86,6 @@ class BaseVM:
return self._project.vm_working_directory(self._uuid) return self._project.vm_working_directory(self._uuid)
def create(self): def create(self):
""" """
Creates the VM. Creates the VM.
@ -100,7 +93,6 @@ class BaseVM:
return return
def start(self): def start(self):
""" """
Starts the VM process. Starts the VM process.
@ -108,7 +100,6 @@ class BaseVM:
raise NotImplementedError raise NotImplementedError
def stop(self): def stop(self):
""" """
Starts the VM process. Starts the VM process.

View File

@ -47,25 +47,21 @@ class Project:
os.mkdir(self._path) os.mkdir(self._path)
os.mkdir(os.path.join(self._path, "vms")) os.mkdir(os.path.join(self._path, "vms"))
@property @property
def uuid(self): def uuid(self):
return self._uuid return self._uuid
@property @property
def location(self): def location(self):
return self._location return self._location
@property @property
def path(self): def path(self):
return self._path return self._path
def vm_working_directory(self, vm_identifier): def vm_working_directory(self, vm_identifier):
""" """
Return a working directory for a specific VM. Return a working directory for a specific VM.
@ -79,7 +75,6 @@ class Project:
os.mkdir(path) os.mkdir(path)
return path return path
def __json__(self): def __json__(self):
return { return {

View File

@ -309,7 +309,7 @@ class VirtualBoxVM(BaseVM):
hdd_info_file = os.path.join(self._working_dir, self._vmname, "hdd_info.json") hdd_info_file = os.path.join(self._working_dir, self._vmname, "hdd_info.json")
try: try:
with open(hdd_info_file, "r") as f: with open(hdd_info_file, "r") as f:
#log.info("loading project: {}".format(path)) # log.info("loading project: {}".format(path))
hdd_table = json.load(f) hdd_table = json.load(f)
except OSError as e: except OSError as e:
raise VirtualBoxError("Could not read HDD info file: {}".format(e)) raise VirtualBoxError("Could not read HDD info file: {}".format(e))
@ -363,7 +363,7 @@ class VirtualBoxVM(BaseVM):
try: try:
hdd_info_file = os.path.join(self._working_dir, self._vmname, "hdd_info.json") hdd_info_file = os.path.join(self._working_dir, self._vmname, "hdd_info.json")
with open(hdd_info_file, "w") as f: with open(hdd_info_file, "w") as f:
#log.info("saving project: {}".format(path)) # log.info("saving project: {}".format(path))
json.dump(hdd_table, f, indent=4) json.dump(hdd_table, f, indent=4)
except OSError as e: except OSError as e:
raise VirtualBoxError("Could not write HDD info file: {}".format(e)) raise VirtualBoxError("Could not write HDD info file: {}".format(e))

View File

@ -28,7 +28,6 @@ import re
import asyncio import asyncio
import socket import socket
import shutil import shutil
import atexit
from pkg_resources import parse_version from pkg_resources import parse_version
from .vpcs_error import VPCSError from .vpcs_error import VPCSError
@ -82,11 +81,9 @@ class VPCSVM(BaseVM):
self._check_requirements() self._check_requirements()
def __del__(self): def __del__(self):
self._kill_process() self._kill_process()
def _check_requirements(self): def _check_requirements(self):
""" """
Check if VPCS is available with the correct version Check if VPCS is available with the correct version
@ -184,7 +181,6 @@ class VPCSVM(BaseVM):
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,
cwd=self.working_dir, cwd=self.working_dir,
creationflags=flags) creationflags=flags)
#atexit(self._kill_process) # Ensure we don't leave orphan process
log.info("VPCS instance {} started PID={}".format(self.name, self._process.pid)) log.info("VPCS instance {} started PID={}".format(self.name, self._process.pid))
self._started = True self._started = True
except (OSError, subprocess.SubprocessError) as e: except (OSError, subprocess.SubprocessError) as e:
@ -192,7 +188,6 @@ class VPCSVM(BaseVM):
log.error("Could not start VPCS {}: {}\n{}".format(self._path, e, vpcs_stdout)) log.error("Could not start VPCS {}: {}\n{}".format(self._path, e, vpcs_stdout))
raise VPCSError("Could not start VPCS {}: {}\n{}".format(self._path, e, vpcs_stdout)) raise VPCSError("Could not start VPCS {}: {}\n{}".format(self._path, e, vpcs_stdout))
@asyncio.coroutine @asyncio.coroutine
def stop(self): def stop(self):
""" """
@ -221,7 +216,6 @@ class VPCSVM(BaseVM):
except ProcessLookupError: except ProcessLookupError:
pass pass
def read_vpcs_stdout(self): def read_vpcs_stdout(self):
""" """
Reads the standard output of the VPCS process. Reads the standard output of the VPCS process.

Some files were not shown because too many files have changed in this diff Show More