]> git.0d.be Git - django-panik-nonstop.git/commitdiff
fix check for soma errors
authorFrédéric Péters <fpeters@0d.be>
Mon, 6 Jan 2020 15:22:44 +0000 (16:22 +0100)
committerFrédéric Péters <fpeters@0d.be>
Mon, 6 Jan 2020 15:22:44 +0000 (16:22 +0100)
nonstop/utils.py

index f165baf88ec89b8373d6ceb67a5f3b79f457e80a..42225c59363698b64e9eaa163d72981515e3686b 100644 (file)
@@ -96,7 +96,7 @@ def add_diffusion(diffusion):
         s.sendall(b'100 - Ok\n')
         s.recv(1024)  # -> b'100 - Welcome to soma daemon\n'
         s.sendall(b'\n')  # (empty password)
-        if s.recv(1024) == b'100 - Ok\n':
+        if s.recv(1024) != b'100 - Ok\n':
             raise SomaException('failed to initialize soma connection')
         return s
 
@@ -113,7 +113,7 @@ def add_diffusion(diffusion):
     palinsesto_xml.append(palinsesti_xml)
     with soma_connection() as s:
         s.sendall(b'106 - Switch to a New Palinsesto Request\n')
-        if s.recv(1024) == b'100 - Ok\n':
+        if s.recv(1024) != b'100 - Ok\n':
             raise SomaException('failed to switch palinsesto')
         s.sendall(ET.tostring(palinsesto_xml).encode('utf-8'))
 
@@ -121,5 +121,5 @@ def add_diffusion(diffusion):
     time.sleep(3)
     with soma_connection() as s:
         s.sendall(b'122 - Set the current Palinsesto as Default\n')
-        if s.recv(1024) == b'100 - Ok\n':
+        if s.recv(1024) != b'100 - Ok\n':
             raise SomaException('failed to set current palinsesto as default')