From 3140aecd2ba4cd9564000b1c5c54ea8d4dd510fa Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Wed, 6 Dec 2023 16:59:38 -0700 Subject: [PATCH] Add more loader dunders to cp module. Using cp module to dip our feet into more explicit loader dunders. Most all of the existing dunders can be imported already. The one outlier being used by the cp module is __opts__. --- salt/loader/dunder.py | 3 +++ salt/modules/cp.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/salt/loader/dunder.py b/salt/loader/dunder.py index d3027098b5a..321e6f9a69d 100644 --- a/salt/loader/dunder.py +++ b/salt/loader/dunder.py @@ -8,3 +8,6 @@ loader_context = salt.loader.context.LoaderContext() __file_client__ = loader_context.named_context("__file_client__", default=None) +__context__ = loader_context.named_context("__context__") +__pillar__ = loader_context.named_context("__pillar__") +__grains__ = loader_context.named_context("__grains__") diff --git a/salt/modules/cp.py b/salt/modules/cp.py index 25b0fcbae91..c9c72a4d026 100644 --- a/salt/modules/cp.py +++ b/salt/modules/cp.py @@ -20,7 +20,7 @@ import salt.utils.path import salt.utils.templates import salt.utils.url from salt.exceptions import CommandExecutionError -from salt.loader.dunder import __file_client__ +from salt.loader.dunder import __context__, __file_client__, __grains__, __pillar__ log = logging.getLogger(__name__)