How to use the watchmaker.utils.copy_subdirectories function in watchmaker

To help you get started, we’ve selected a few watchmaker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github plus3it / watchmaker / tests / test_utils.py View on Github external
def test_copy_subdirectories(mock_os, mock_copy, mock_exists):
    """Test that copy_subdirectories executes expected calls."""
    random_src = '580a9176-20f6-4f64-b77a-75dbea14d74f'
    random_dst = '6538965c-5131-414a-897f-b01f7dfb6c2b'
    mock_exists.return_value = False
    mock_os.return_value = [
        ('580a9176-20f6-4f64-b77a-75dbea14d74f', ('87a2a74d',)),
        ('580a9176-20f6-4f64-b77a-75dbea14d74f/87a2a74d', (),
            ('6274fd83', '1923c65a')),
    ].__iter__()

    watchmaker.utils.copy_subdirectories(random_src, random_dst, None)
    assert mock_copy.call_count == 1
github plus3it / watchmaker / src / watchmaker / workers / salt.py View on Github external
' \'{0}\' in {1}'.format(
                              self.salt_content_path,
                              self.salt_content)
                    self.log.critical(msg)
                    raise WatchmakerException(msg)
                try:
                    salt_files_dir = salt_content_glob[0]
                except IndexError:
                    msg = 'Salt content glob path \'{0}\' not' \
                          ' found in {1}'.format(
                              self.salt_content_path,
                              self.salt_content)
                    self.log.critical(msg)
                    raise WatchmakerException(msg)

                watchmaker.utils.copy_subdirectories(
                    salt_files_dir, extract_dir, self.log)

        bundled_content = os.sep.join(
            (static.__path__[0], 'salt', 'content')
        )
        watchmaker.utils.copy_subdirectories(
            bundled_content, extract_dir, self.log)

        with codecs.open(
            os.path.join(self.salt_conf_path, 'minion'),
            'r+',
            encoding="utf-8"
        ) as fh_:
            salt_conf = yaml.safe_load(fh_)
            salt_conf.update(self.salt_file_roots)
            fh_.seek(0)
github plus3it / watchmaker / src / watchmaker / workers / salt.py View on Github external
salt_files_dir = salt_content_glob[0]
                except IndexError:
                    msg = 'Salt content glob path \'{0}\' not' \
                          ' found in {1}'.format(
                              self.salt_content_path,
                              self.salt_content)
                    self.log.critical(msg)
                    raise WatchmakerException(msg)

                watchmaker.utils.copy_subdirectories(
                    salt_files_dir, extract_dir, self.log)

        bundled_content = os.sep.join(
            (static.__path__[0], 'salt', 'content')
        )
        watchmaker.utils.copy_subdirectories(
            bundled_content, extract_dir, self.log)

        with codecs.open(
            os.path.join(self.salt_conf_path, 'minion'),
            'r+',
            encoding="utf-8"
        ) as fh_:
            salt_conf = yaml.safe_load(fh_)
            salt_conf.update(self.salt_file_roots)
            fh_.seek(0)
            yaml.safe_dump(salt_conf, fh_, default_flow_style=False)