mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-11-16 16:54:51 +02:00
Yet another PEP 8 :)
This commit is contained in:
parent
7cf409c392
commit
bbee5f90a0
@ -52,7 +52,7 @@ class Rackspace(object):
|
||||
self.authenticated = self.rksp.authenticate()
|
||||
|
||||
def _find_my_instance(self):
|
||||
if self.authenticated == False:
|
||||
if self.authenticated is not False:
|
||||
log.critical("Not authenticated against rackspace!!!!")
|
||||
|
||||
for region in self.rksp.list_regions():
|
||||
|
@ -33,13 +33,11 @@ class BaseVM:
|
||||
|
||||
# TODO: When delete release console ports
|
||||
|
||||
|
||||
@property
|
||||
def project(self):
|
||||
"""Return VM current project"""
|
||||
return self._project
|
||||
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
@ -50,7 +48,6 @@ class BaseVM:
|
||||
|
||||
return self._name
|
||||
|
||||
|
||||
@name.setter
|
||||
def name(self, new_name):
|
||||
"""
|
||||
@ -61,7 +58,6 @@ class BaseVM:
|
||||
|
||||
self._name = new_name
|
||||
|
||||
|
||||
@property
|
||||
def uuid(self):
|
||||
"""
|
||||
@ -72,7 +68,6 @@ class BaseVM:
|
||||
|
||||
return self._uuid
|
||||
|
||||
|
||||
@property
|
||||
def manager(self):
|
||||
"""
|
||||
@ -83,7 +78,6 @@ class BaseVM:
|
||||
|
||||
return self._manager
|
||||
|
||||
|
||||
@property
|
||||
def working_dir(self):
|
||||
"""
|
||||
@ -92,7 +86,6 @@ class BaseVM:
|
||||
|
||||
return self._project.vm_working_directory(self._uuid)
|
||||
|
||||
|
||||
def create(self):
|
||||
"""
|
||||
Creates the VM.
|
||||
@ -100,7 +93,6 @@ class BaseVM:
|
||||
|
||||
return
|
||||
|
||||
|
||||
def start(self):
|
||||
"""
|
||||
Starts the VM process.
|
||||
@ -108,7 +100,6 @@ class BaseVM:
|
||||
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
def stop(self):
|
||||
"""
|
||||
Starts the VM process.
|
||||
|
@ -47,25 +47,21 @@ class Project:
|
||||
os.mkdir(self._path)
|
||||
os.mkdir(os.path.join(self._path, "vms"))
|
||||
|
||||
|
||||
@property
|
||||
def uuid(self):
|
||||
|
||||
return self._uuid
|
||||
|
||||
|
||||
@property
|
||||
def location(self):
|
||||
|
||||
return self._location
|
||||
|
||||
|
||||
@property
|
||||
def path(self):
|
||||
|
||||
return self._path
|
||||
|
||||
|
||||
def vm_working_directory(self, vm_identifier):
|
||||
"""
|
||||
Return a working directory for a specific VM.
|
||||
@ -79,7 +75,6 @@ class Project:
|
||||
os.mkdir(path)
|
||||
return path
|
||||
|
||||
|
||||
def __json__(self):
|
||||
|
||||
return {
|
||||
|
@ -309,7 +309,7 @@ class VirtualBoxVM(BaseVM):
|
||||
hdd_info_file = os.path.join(self._working_dir, self._vmname, "hdd_info.json")
|
||||
try:
|
||||
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)
|
||||
except OSError as e:
|
||||
raise VirtualBoxError("Could not read HDD info file: {}".format(e))
|
||||
@ -363,7 +363,7 @@ class VirtualBoxVM(BaseVM):
|
||||
try:
|
||||
hdd_info_file = os.path.join(self._working_dir, self._vmname, "hdd_info.json")
|
||||
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)
|
||||
except OSError as e:
|
||||
raise VirtualBoxError("Could not write HDD info file: {}".format(e))
|
||||
|
@ -28,7 +28,6 @@ import re
|
||||
import asyncio
|
||||
import socket
|
||||
import shutil
|
||||
import atexit
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from .vpcs_error import VPCSError
|
||||
@ -82,11 +81,9 @@ class VPCSVM(BaseVM):
|
||||
|
||||
self._check_requirements()
|
||||
|
||||
|
||||
def __del__(self):
|
||||
self._kill_process()
|
||||
|
||||
|
||||
def _check_requirements(self):
|
||||
"""
|
||||
Check if VPCS is available with the correct version
|
||||
@ -184,7 +181,6 @@ class VPCSVM(BaseVM):
|
||||
stderr=subprocess.STDOUT,
|
||||
cwd=self.working_dir,
|
||||
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))
|
||||
self._started = True
|
||||
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))
|
||||
raise VPCSError("Could not start VPCS {}: {}\n{}".format(self._path, e, vpcs_stdout))
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def stop(self):
|
||||
"""
|
||||
@ -221,7 +216,6 @@ class VPCSVM(BaseVM):
|
||||
except ProcessLookupError:
|
||||
pass
|
||||
|
||||
|
||||
def read_vpcs_stdout(self):
|
||||
"""
|
||||
Reads the standard output of the VPCS process.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user