Skip to content

Commit

Permalink
Merge pull request ceph#60347 from avanthakkar/rm-smb-dump-everything
Browse files Browse the repository at this point in the history
mgr/smb: rm all `smb dump` commands

Reviewed-by: Adam King <[email protected]>
Reviewed-by: John Mulligan <[email protected]>
  • Loading branch information
adk3798 authored Oct 17, 2024
2 parents 99aa9e0 + 82b6a1c commit 306cb89
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 129 deletions.
41 changes: 1 addition & 40 deletions src/pybind/mgr/smb/module.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Any, Dict, List, Optional, cast
from typing import TYPE_CHECKING, Any, List, Optional, cast

import logging

Expand Down Expand Up @@ -350,45 +350,6 @@ def show(self, resource_names: Optional[List[str]] = None) -> Simplified:
return resources[0].to_simplified()
return {'resources': [r.to_simplified() for r in resources]}

@cli.SMBCommand('dump cluster-config', perm='r')
def dump_config(self, cluster_id: str) -> Dict[str, Any]:
"""DEBUG: Generate an example configuration"""
# TODO: Remove this command prior to release
return self._handler.generate_config(cluster_id)

@cli.SMBCommand('dump service-spec', perm='r')
def dump_service_spec(self, cluster_id: str) -> Dict[str, Any]:
"""DEBUG: Generate an example smb service spec"""
# TODO: Remove this command prior to release
return dict(
self._handler.generate_smb_service_spec(cluster_id).to_json()
)

@cli.SMBCommand('dump everything', perm='r')
def dump_everything(self) -> Dict[str, Any]:
"""DEBUG: Show me everything"""
# TODO: Remove this command prior to release
everything: Dict[str, Any] = {}
everything['PUBLIC'] = {}
log.warning('dumping PUBLIC')
for key in self._public_store:
e = self._public_store[key]
log.warning('dumping e: %s %r', e.uri, e.full_key)
everything['PUBLIC'][e.uri] = e.get()
log.warning('dumping PRIV')
everything['PRIV'] = {}
for key in self._priv_store:
e = self._priv_store[key]
log.warning('dumping e: %s %r', e.uri, e.full_key)
everything['PRIV'][e.uri] = e.get()
log.warning('dumping INTERNAL')
everything['INTERNAL'] = {}
for key in self._internal_store:
e = self._internal_store[key]
log.warning('dumping e: %s %r', e.uri, e.full_key)
everything['INTERNAL'][e.uri] = e.get()
return everything

def submit_smb_spec(self, spec: SMBSpec) -> None:
"""Submit a new or updated smb spec object to ceph orchestration."""
completion = self.apply_smb(spec)
Expand Down
89 changes: 0 additions & 89 deletions src/pybind/mgr/smb/tests/test_smb.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,72 +410,6 @@ def test_cmd_apply_share(tmodule):
assert bdata["results"][0]["state"] == "created"


def test_share_dump_config(tmodule):
_example_cfg_1(tmodule)

cfg = tmodule.dump_config('foo')
assert cfg == {
'samba-container-config': "v0",
'configs': {
'foo': {
'instance_name': 'foo',
'instance_features': [],
'shares': ['Ess One', 'Ess Two'],
'globals': ['default', 'foo'],
},
},
'shares': {
'Ess One': {
'options': {
'path': '/',
'read only': 'No',
'browseable': 'Yes',
'kernel share modes': 'no',
'x:ceph:id': 'foo.s1',
'vfs objects': 'acl_xattr ceph_new',
'acl_xattr:security_acl_name': 'user.NTACL',
'ceph_new:config_file': '/etc/ceph/ceph.conf',
'ceph_new:filesystem': 'cephfs',
'ceph_new:user_id': 'smb.fs.cluster.foo',
},
},
'Ess Two': {
'options': {
'path': '/two',
'read only': 'No',
'browseable': 'Yes',
'kernel share modes': 'no',
'x:ceph:id': 'foo.stwo',
'vfs objects': 'acl_xattr ceph_new',
'acl_xattr:security_acl_name': 'user.NTACL',
'ceph_new:config_file': '/etc/ceph/ceph.conf',
'ceph_new:filesystem': 'cephfs',
'ceph_new:user_id': 'smb.fs.cluster.foo',
},
},
},
'globals': {
'default': {
'options': {
'load printers': 'No',
'printing': 'bsd',
'printcap name': '/dev/null',
'disable spoolss': 'Yes',
},
},
'foo': {
'options': {
'idmap config * : backend': 'autorid',
'idmap config * : range': '2000-9999999',
'realm': 'dom1.example.com',
'security': 'ads',
'workgroup': 'DOM1',
},
},
},
}


def test_cluster_create_ad1(tmodule):
_example_cfg_1(tmodule)

Expand Down Expand Up @@ -613,29 +547,6 @@ def test_cluster_rm(tmodule):
assert result.success


def test_dump_service_spec(tmodule):
_example_cfg_1(tmodule)
tmodule._public_store.overwrite(
{
'foo.config.smb': '',
}
)
tmodule._priv_store.overwrite(
{
'foo.join.2b9902c05d08bcba.json': '',
'foo.join.08129d4d3b8c37c7.json': '',
}
)

cfg = tmodule.dump_service_spec('foo')
assert cfg
assert cfg['service_id'] == 'foo'
assert cfg['spec']['cluster_id'] == 'foo'
assert cfg['spec']['features'] == ['domain']
assert cfg['spec']['config_uri'] == 'mem:foo/config.smb'
assert len(cfg['spec']['join_sources']) == 2


def test_cmd_show_resource_json(tmodule):
_example_cfg_1(tmodule)

Expand Down

0 comments on commit 306cb89

Please sign in to comment.