From a34502ddf6e49b6f634ef8eba537122bf17f2cd0 Mon Sep 17 00:00:00 2001 From: Andrew Walker Date: Tue, 24 Dec 2024 15:47:01 -0600 Subject: [PATCH] Fix crash when generating SMB configuration on standby --- src/middlewared/middlewared/etc_files/local/smb4.conf.mako | 2 +- src/middlewared/middlewared/plugins/smb.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/middlewared/middlewared/etc_files/local/smb4.conf.mako b/src/middlewared/middlewared/etc_files/local/smb4.conf.mako index 30a12b922c244..d57214047e332 100644 --- a/src/middlewared/middlewared/etc_files/local/smb4.conf.mako +++ b/src/middlewared/middlewared/etc_files/local/smb4.conf.mako @@ -2,7 +2,7 @@ # SMB.CONF(5) The configuration file for the Samba suite # <% - shares = render_ctx['smb.generate_smb_configuration'].pop('SHARES') + shares = render_ctx['smb.generate_smb_configuration'].pop('SHARES', []) %> [global] diff --git a/src/middlewared/middlewared/plugins/smb.py b/src/middlewared/middlewared/plugins/smb.py index 95cf896c5e4b1..e8fb7f38873be 100644 --- a/src/middlewared/middlewared/plugins/smb.py +++ b/src/middlewared/middlewared/plugins/smb.py @@ -127,7 +127,7 @@ async def unixcharset_choices(self): @private def generate_smb_configuration(self): if self.middleware.call_sync('failover.status') not in ('SINGLE', 'MASTER'): - return {'netbiosname': 'TN_STANDBY'} + return {'netbiosname': 'TN_STANDBY', 'SHARES': []} if (ds_type := self.middleware.call_sync('directoryservices.status')['type']) is not None: ds_type = DSType(ds_type)