]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/smb: share and cluster create commands only create resources
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 1 May 2024 14:57:02 +0000 (10:57 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 13 Jun 2024 13:54:05 +0000 (09:54 -0400)
Prior to this change the create commands could be used counter to the
term 'create' as a create-or-update command. IMO this violates the
principle of least surprise so make them create-only.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/smb/module.py

index a6eef0cb4fb77748ecda88e8d8082ab7daf22820..fcaf2d3d67001fe8e9897fd7299f650a5e622aff 100644 (file)
@@ -178,7 +178,7 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule):
             placement=pspec,
         )
         to_apply.append(cluster)
-        return self._handler.apply(to_apply).squash(cluster)
+        return self._handler.apply(to_apply, create_only=True).squash(cluster)
 
     @cli.SMBCommand('cluster rm', perm='rw')
     def cluster_rm(self, cluster_id: str) -> handler.Result:
@@ -220,7 +220,7 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule):
                 subvolume=subvolume,
             ),
         )
-        return self._handler.apply([share]).one()
+        return self._handler.apply([share], create_only=True).one()
 
     @cli.SMBCommand('share rm', perm='rw')
     def share_rm(self, cluster_id: str, share_id: str) -> handler.Result: