|
|
|
@ -24,6 +24,7 @@ from ..util import (
|
|
|
|
|
ABC,
|
|
|
|
|
to_bytes,
|
|
|
|
|
make_dirs,
|
|
|
|
|
ANSIBLE_TEST_CONFIG_ROOT,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
from ..target import (
|
|
|
|
@ -188,7 +189,12 @@ class CloudBase(ABC):
|
|
|
|
|
def config_callback(files): # type: (t.List[t.Tuple[str, str]]) -> None
|
|
|
|
|
"""Add the config file to the payload file list."""
|
|
|
|
|
if self._get_cloud_config(self._CONFIG_PATH, ''):
|
|
|
|
|
pair = (self.config_path, os.path.relpath(self.config_path, data_context().content.root))
|
|
|
|
|
if data_context().content.collection:
|
|
|
|
|
working_path = data_context().content.collection.directory
|
|
|
|
|
else:
|
|
|
|
|
working_path = ''
|
|
|
|
|
|
|
|
|
|
pair = (self.config_path, os.path.join(working_path, os.path.relpath(self.config_path, data_context().content.root)))
|
|
|
|
|
|
|
|
|
|
if pair not in files:
|
|
|
|
|
display.info('Including %s config: %s -> %s' % (self.platform, pair[0], pair[1]), verbosity=3)
|
|
|
|
@ -283,8 +289,9 @@ class CloudProvider(CloudBase):
|
|
|
|
|
super(CloudProvider, self).__init__(args)
|
|
|
|
|
|
|
|
|
|
self.remove_config = False
|
|
|
|
|
self.config_static_path = '%s/cloud-config-%s%s' % (self.TEST_DIR, self.platform, config_extension)
|
|
|
|
|
self.config_template_path = '%s.template' % self.config_static_path
|
|
|
|
|
self.config_static_name = 'cloud-config-%s%s' % (self.platform, config_extension)
|
|
|
|
|
self.config_static_path = os.path.join(self.TEST_DIR, self.config_static_name)
|
|
|
|
|
self.config_template_path = os.path.join(ANSIBLE_TEST_CONFIG_ROOT, '%s.template' % self.config_static_name)
|
|
|
|
|
self.config_extension = config_extension
|
|
|
|
|
|
|
|
|
|
def filter(self, targets, exclude):
|
|
|
|
@ -349,9 +356,8 @@ class CloudProvider(CloudBase):
|
|
|
|
|
with tempfile.NamedTemporaryFile(dir=self.TEST_DIR, prefix=prefix, suffix=self.config_extension, delete=False) as config_fd:
|
|
|
|
|
filename = os.path.join(self.TEST_DIR, os.path.basename(config_fd.name))
|
|
|
|
|
|
|
|
|
|
self.config_path = config_fd.name
|
|
|
|
|
self.config_path = filename
|
|
|
|
|
self.remove_config = True
|
|
|
|
|
self._set_cloud_config('config_path', filename)
|
|
|
|
|
|
|
|
|
|
display.info('>>> Config: %s\n%s' % (filename, content.strip()), verbosity=3)
|
|
|
|
|
|
|
|
|
|