summaryrefslogtreecommitdiff
path: root/boto/manage
diff options
context:
space:
mode:
authorAustin Marshall <oxtopus@gmail.com>2013-12-18 22:43:32 -0600
committerAustin Marshall <oxtopus@gmail.com>2013-12-18 22:43:32 -0600
commit125a8394143be713e6683bac34d7842421fe8b70 (patch)
tree4f21a53baf018500cb1264718c8d0448a29bd5e2 /boto/manage
parentdcf3cbd51f5d997eb84a5bf5ec9ff20f322fa44f (diff)
downloadboto-125a8394143be713e6683bac34d7842421fe8b70.tar.gz
Consistent use of identity comparison (`is`/`is not`) for None
Diffstat (limited to 'boto/manage')
-rw-r--r--boto/manage/cmdshell.py2
-rw-r--r--boto/manage/server.py4
-rw-r--r--boto/manage/task.py2
-rw-r--r--boto/manage/volume.py16
4 files changed, 12 insertions, 12 deletions
diff --git a/boto/manage/cmdshell.py b/boto/manage/cmdshell.py
index 0da1c7a3..bd0813ec 100644
--- a/boto/manage/cmdshell.py
+++ b/boto/manage/cmdshell.py
@@ -182,7 +182,7 @@ class LocalClient(object):
log_fp = StringIO.StringIO()
process = subprocess.Popen(self.command, shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- while process.poll() == None:
+ while process.poll() is None:
time.sleep(1)
t = process.communicate()
log_fp.write(t[0])
diff --git a/boto/manage/server.py b/boto/manage/server.py
index 3acc4b2f..bcde8834 100644
--- a/boto/manage/server.py
+++ b/boto/manage/server.py
@@ -303,7 +303,7 @@ class Server(Model):
group = params.get('group')
zone = params.get('zone')
# deal with possibly passed in logical volume:
- if logical_volume != None:
+ if logical_volume is not None:
cfg.set('EBS', 'logical_volume_name', logical_volume.name)
cfg_fp = StringIO.StringIO()
cfg.write(cfg_fp)
@@ -323,7 +323,7 @@ class Server(Model):
i = 0
elastic_ip = params.get('elastic_ip')
instances = reservation.instances
- if elastic_ip != None and instances.__len__() > 0:
+ if elastic_ip is not None and instances.__len__() > 0:
instance = instances[0]
print 'Waiting for instance to start so we can set its elastic IP address...'
# Sometimes we get a message from ec2 that says that the instance does not exist.
diff --git a/boto/manage/task.py b/boto/manage/task.py
index 1c37c697..885d0726 100644
--- a/boto/manage/task.py
+++ b/boto/manage/task.py
@@ -105,7 +105,7 @@ class Task(Model):
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
nsecs = 5
current_timeout = vtimeout
- while process.poll() == None:
+ while process.poll() is None:
boto.log.info('nsecs=%s, timeout=%s' % (nsecs, current_timeout))
if nsecs >= current_timeout:
current_timeout += vtimeout
diff --git a/boto/manage/volume.py b/boto/manage/volume.py
index 49237d47..7a312370 100644
--- a/boto/manage/volume.py
+++ b/boto/manage/volume.py
@@ -136,7 +136,7 @@ class Volume(Model):
if size < self.size:
size = self.size
ec2 = self.get_ec2_connection()
- if self.zone_name == None or self.zone_name == '':
+ if self.zone_name is None or self.zone_name == '':
# deal with the migration case where the zone is not set in the logical volume:
current_volume = ec2.get_all_volumes([self.volume_id])[0]
self.zone_name = current_volume.zone
@@ -155,7 +155,7 @@ class Volume(Model):
def get_ec2_connection(self):
if self.server:
return self.server.ec2
- if not hasattr(self, 'ec2') or self.ec2 == None:
+ if not hasattr(self, 'ec2') or self.ec2 is None:
self.ec2 = boto.ec2.connect_to_region(self.region_name)
return self.ec2
@@ -209,7 +209,7 @@ class Volume(Model):
def detach(self, force=False):
state = self.attachment_state
- if state == 'available' or state == None or state == 'detaching':
+ if state == 'available' or state is None or state == 'detaching':
print 'already detached'
return None
ec2 = self.get_ec2_connection()
@@ -218,7 +218,7 @@ class Volume(Model):
self.put()
def checkfs(self, use_cmd=None):
- if self.server == None:
+ if self.server is None:
raise ValueError('server attribute must be set to run this command')
# detemine state of file system on volume, only works if attached
if use_cmd:
@@ -233,7 +233,7 @@ class Volume(Model):
return True
def wait(self):
- if self.server == None:
+ if self.server is None:
raise ValueError('server attribute must be set to run this command')
with closing(self.server.get_cmdshell()) as cmd:
# wait for the volume device to appear
@@ -243,7 +243,7 @@ class Volume(Model):
time.sleep(10)
def format(self):
- if self.server == None:
+ if self.server is None:
raise ValueError('server attribute must be set to run this command')
status = None
with closing(self.server.get_cmdshell()) as cmd:
@@ -253,7 +253,7 @@ class Volume(Model):
return status
def mount(self):
- if self.server == None:
+ if self.server is None:
raise ValueError('server attribute must be set to run this command')
boto.log.info('handle_mount_point')
with closing(self.server.get_cmdshell()) as cmd:
@@ -302,7 +302,7 @@ class Volume(Model):
# we need to freeze the XFS file system
try:
self.freeze()
- if self.server == None:
+ if self.server is None:
snapshot = self.get_ec2_connection().create_snapshot(self.volume_id)
else:
snapshot = self.server.ec2.create_snapshot(self.volume_id)