From fff29f049e1f7b2103f4527ae440c92950ade6b0 Mon Sep 17 00:00:00 2001 From: Arata Notsu Date: Fri, 8 May 2015 01:40:10 +0900 Subject: [PATCH] Not use "is" to compare strings As "is" tests whether if operands are the same object rather than they have the same value, potentially causes a wrong result. --- system/service.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/system/service.py b/system/service.py index 3589340f152..5627f128c92 100644 --- a/system/service.py +++ b/system/service.py @@ -862,7 +862,7 @@ class LinuxService(Service): if self.svc_cmd and self.svc_cmd.endswith('rc-service') and self.action == 'start' and self.crashed: self.execute_command("%s zap" % svc_cmd, daemonize=True) - if self.action is not "restart": + if self.action != "restart": if svc_cmd != '': # upstart or systemd or OpenRC rc_state, stdout, stderr = self.execute_command("%s %s %s" % (svc_cmd, self.action, arguments), daemonize=True) @@ -970,11 +970,11 @@ class FreeBsdService(Service): def service_control(self): - if self.action is "start": + if self.action == "start": self.action = "onestart" - if self.action is "stop": + if self.action == "stop": self.action = "onestop" - if self.action is "reload": + if self.action == "reload": self.action = "onereload" return self.execute_command("%s %s %s %s" % (self.svc_cmd, self.name, self.action, self.arguments)) @@ -1180,9 +1180,9 @@ class NetBsdService(Service): self.running = True def service_control(self): - if self.action is "start": + if self.action == "start": self.action = "onestart" - if self.action is "stop": + if self.action == "stop": self.action = "onestop" self.svc_cmd = "%s" % self.svc_initscript