netcmd: models: move MODELS constant to constants.py to avoid import loop
authorRob van der Linde <rob@catalyst.net.nz>
Tue, 20 Feb 2024 02:19:12 +0000 (15:19 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 1 Mar 2024 04:45:36 +0000 (04:45 +0000)
query.py and models.py otherwise cause an import loop, query.py needs to import MODELS

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/netcmd/domain/models/__init__.py
python/samba/netcmd/domain/models/constants.py [new file with mode: 0644]
python/samba/netcmd/domain/models/model.py

index 8051a5c36482d55cc064c0b7b0e21fad76f042c4..d9185b51bf0ce1b6bf753e5c8d8ec8534f37bc47 100644 (file)
@@ -25,9 +25,9 @@ from .auth_policy import (AuthenticationPolicy, StrongNTLMPolicy,
 from .auth_silo import AuthenticationSilo
 from .claim_type import ClaimType
 from .computer import Computer
+from .constants import MODELS
 from .gmsa import GroupManagedServiceAccount
 from .group import Group
-from .model import MODELS
 from .schema import AttributeSchema, ClassSchema
 from .site import Site
 from .subnet import Subnet
diff --git a/python/samba/netcmd/domain/models/constants.py b/python/samba/netcmd/domain/models/constants.py
new file mode 100644 (file)
index 0000000..d1b3cc1
--- /dev/null
@@ -0,0 +1,25 @@
+# Unix SMB/CIFS implementation.
+#
+# Model constants
+#
+# Copyright (C) Catalyst.Net Ltd. 2023
+#
+# Written by Rob van der Linde <rob@catalyst.net.nz>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+# Keeps track of registered models.
+# This gets populated by the ModelMeta class.
+MODELS = {}
index 42de54fa5c7fb61e99a8144b33a54ce033771317..3ad26c6b2b87af1e5233377bba5149fb9b136dc4 100644 (file)
@@ -28,16 +28,13 @@ from ldb import (ERR_NO_SUCH_OBJECT, FLAG_MOD_ADD, FLAG_MOD_REPLACE,
                  SCOPE_SUBTREE)
 from samba.sd_utils import SDUtils
 
+from .constants import MODELS
 from .exceptions import (DeleteError, FieldError, NotFound, ProtectError,
                          UnprotectError)
 from .fields import (DateTimeField, DnField, Field, GUIDField, IntegerField,
                      StringField)
 from .query import Query
 
-# Keeps track of registered models.
-# This gets populated by the ModelMeta class.
-MODELS = {}
-
 
 class ModelMeta(ABCMeta):