]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/snap_schedule: return negative error codes
authorVenky Shankar <vshankar@redhat.com>
Tue, 19 May 2020 04:51:40 +0000 (00:51 -0400)
committerJan Fajerski <jfajerski@suse.com>
Thu, 27 Aug 2020 13:55:46 +0000 (15:55 +0200)
Signed-off-by: Venky Shankar <vshankar@redhat.com>
src/pybind/mgr/snap_schedule/module.py

index f57920c14769ace54fcd5d2612fd5483decbacb1..e87c085f80ab68e372c1c29742b198019b0cb520 100644 (file)
@@ -103,7 +103,7 @@ class Module(MgrModule):
             report = [s.report() for s in existing_scheds]
             error_msg = f'Found existing schedule {report}'
             self.log.error(error_msg)
-            return errno.EEXISTS, '', error_msg
+            return -errno.EEXIST, '', error_msg
         except CephfsConnectionException as e:
             return e.to_tuple()
         return 0, suc_msg, ''
@@ -128,7 +128,7 @@ class Module(MgrModule):
         except CephfsConnectionException as e:
             return e.to_tuple()
         except ValueError as e:
-            return errno.ENOENT, '', str(e)
+            return -errno.ENOENT, '', str(e)
         return 0, 'Schedule removed for path {}'.format(path), ''
 
     @CLIWriteCommand('fs snap-schedule activate',
@@ -151,7 +151,7 @@ class Module(MgrModule):
         except CephfsConnectionException as e:
             return e.to_tuple()
         except ValueError as e:
-            return errno.ENOENT, '', str(e)
+            return -errno.ENOENT, '', str(e)
         return 0, 'Schedule activated for path {}'.format(path), ''
 
     @CLIWriteCommand('fs snap-schedule deactivate',
@@ -174,5 +174,5 @@ class Module(MgrModule):
         except CephfsConnectionException as e:
             return e.to_tuple()
         except ValueError as e:
-            return errno.ENOENT, '', str(e)
+            return -errno.ENOENT, '', str(e)
         return 0, 'Schedule deactivated for path {}'.format(path), ''