mirror of
https://github.com/ceph/ceph
synced 2025-02-23 11:07:35 +00:00
Merge pull request #60347 from avanthakkar/rm-smb-dump-everything
mgr/smb: rm all `smb dump` commands Reviewed-by: Adam King <adking@redhat.com> Reviewed-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
commit
306cb89192
@ -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
|
||||
|
||||
@ -350,45 +350,6 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule):
|
||||
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)
|
||||
|
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user