diff --git a/doc/topics/tutorials/gitfs.rst b/doc/topics/tutorials/gitfs.rst index 02a7f0ecad..0349509d21 100644 --- a/doc/topics/tutorials/gitfs.rst +++ b/doc/topics/tutorials/gitfs.rst @@ -103,8 +103,8 @@ RedHat Pygit2 Issues The release of RedHat/CentOS 7.3 upgraded both ``python-cffi`` and ``http-parser``, both of which are dependencies for pygit2_/libgit2_. Both -pygit2_ and libgit2_ (which are from the EPEL repository and not managed -directly by RedHat) need to be rebuilt against these updated dependencies. +``pygit2`` and ``libgit2`` packages (which are from the EPEL repository) should +be upgraded to the most recent versions, at least to ``0.24.2``. The below errors will show up in the master log if an incompatible ``python-pygit2`` package is installed: @@ -123,30 +123,8 @@ package is installed: 2017-02-15 18:04:45,211 [salt.utils.gitfs ][ERROR ][6211] Error occurred fetching gitfs remote 'https://foo.com/bar.git': No Content-Type header in response -As of 15 February 2017, ``python-pygit2`` has been rebuilt and is in the stable -EPEL repository. However, ``libgit2`` remains broken (a `bug report`_ has been -filed to get it rebuilt). - -In the meantime, you can work around this by downgrading ``http-parser``. To do -this, go to `this page`_ and download the appropriate ``http-parser`` RPM for -the OS architecture you are using (x86_64, etc.). Then downgrade using the -``rpm`` command. For example: - -.. code-block:: bash - - [root@784e8a8c5028 /]# curl --silent -O https://kojipkgs.fedoraproject.org//packages/http-parser/2.0/5.20121128gitcd01361.el7/x86_64/http-parser-2.0-5.20121128gitcd01361.el7.x86_64.rpm - [root@784e8a8c5028 /]# rpm -Uvh --oldpackage http-parser-2.0-5.20121128gitcd01361.el7.x86_64.rpm - Preparing... ################################# [100%] - Updating / installing... - 1:http-parser-2.0-5.20121128gitcd01################################# [ 50%] - Cleaning up / removing... - 2:http-parser-2.7.1-3.el7 ################################# [100%] - -A restart of the salt-master daemon may be required to allow http(s) -repositories to continue to be fetched. - -.. _`this page`: https://koji.fedoraproject.org/koji/buildinfo?buildID=703753 -.. _`bug report`: https://bugzilla.redhat.com/show_bug.cgi?id=1422583 +A restart of the ``salt-master`` daemon and gitfs cache directory clean up may +be required to allow http(s) repositories to continue to be fetched. GitPython diff --git a/salt/modules/aptpkg.py b/salt/modules/aptpkg.py index f781db28c9..7f66dfb236 100644 --- a/salt/modules/aptpkg.py +++ b/salt/modules/aptpkg.py @@ -111,7 +111,7 @@ def __init__(opts): a few env variables to keep apt happy and non-interactive. ''' - if __virtual__(): + if __virtual__() == __virtualname__: # Export these puppies so they persist os.environ.update(DPKG_ENV_VARS) diff --git a/salt/modules/win_pkg.py b/salt/modules/win_pkg.py index 7e719371a0..6547e1746e 100644 --- a/salt/modules/win_pkg.py +++ b/salt/modules/win_pkg.py @@ -829,9 +829,9 @@ def genrepo(**kwargs): def _repo_process_pkg_sls(filename, short_path_name, ret, successful_verbose): renderers = salt.loader.render(__opts__, __salt__) - def _failed_compile(msg): - log.error(msg) - ret.setdefault('errors', {})[short_path_name] = [msg] + def _failed_compile(prefix_msg, error_msg): + log.error('{0} \'{1}\': {2} '.format(prefix_msg, short_path_name, error_msg)) + ret.setdefault('errors', {})[short_path_name] = ['{0}, {1} '.format(prefix_msg, error_msg)] return False try: @@ -842,13 +842,11 @@ def _repo_process_pkg_sls(filename, short_path_name, ret, successful_verbose): __opts__.get('renderer_blacklist', ''), __opts__.get('renderer_whitelist', '')) except SaltRenderError as exc: - msg = 'Failed to compile \'{0}\': {1}'.format(short_path_name, exc) - return _failed_compile(msg) + return _failed_compile('Failed to compile', exc) except Exception as exc: - msg = 'Failed to read \'{0}\': {1}'.format(short_path_name, exc) - return _failed_compile(msg) + return _failed_compile('Failed to read', exc) - if config: + if config and isinstance(config, dict): revmap = {} errors = [] for pkgname, version_list in six.iteritems(config): @@ -890,6 +888,8 @@ def _repo_process_pkg_sls(filename, short_path_name, ret, successful_verbose): ret.setdefault('repo', {}).update(config) ret.setdefault('name_map', {}).update(revmap) successful_verbose[short_path_name] = config.keys() + elif config: + return _failed_compile('Compiled contents', 'not a dictionary/hash') else: log.debug('No data within \'%s\' after processing', short_path_name) # no pkgname found after render diff --git a/tests/integration/modules/test_pip.py b/tests/integration/modules/test_pip.py index 0937434cba..1a141fd168 100644 --- a/tests/integration/modules/test_pip.py +++ b/tests/integration/modules/test_pip.py @@ -47,7 +47,7 @@ class PipModuleTest(ModuleCase): ''' return any(w in ret for w in ['URLError', 'Download error']) - def pip_successful_install(self, target, expect=('flake8', 'pep8',)): + def pip_successful_install(self, target, expect=('tox', 'pep8',)): ''' isolate regex for extracting `successful install` message from pip ''' @@ -102,7 +102,7 @@ class PipModuleTest(ModuleCase): with salt.utils.fopen(req1_filename, 'w') as f: f.write('-r requirements1b.txt\n') with salt.utils.fopen(req1b_filename, 'w') as f: - f.write('flake8\n') + f.write('tox\n') with salt.utils.fopen(req2_filename, 'w') as f: f.write('-r requirements2b.txt\n') with salt.utils.fopen(req2b_filename, 'w') as f: @@ -140,7 +140,7 @@ class PipModuleTest(ModuleCase): with salt.utils.fopen(req1_filename, 'w') as f: f.write('-r requirements1b.txt\n') with salt.utils.fopen(req1b_filename, 'w') as f: - f.write('flake8\n') + f.write('tox\n') with salt.utils.fopen(req2_filename, 'w') as f: f.write('-r requirements2b.txt\n') with salt.utils.fopen(req2b_filename, 'w') as f: @@ -173,7 +173,7 @@ class PipModuleTest(ModuleCase): req2_filename = os.path.join(self.venv_dir, 'requirements2.txt') with salt.utils.fopen(req1_filename, 'w') as f: - f.write('flake8\n') + f.write('tox\n') with salt.utils.fopen(req2_filename, 'w') as f: f.write('pep8\n') @@ -210,7 +210,7 @@ class PipModuleTest(ModuleCase): req2_filepath = os.path.join(req_cwd, req2_filename) with salt.utils.fopen(req1_filepath, 'w') as f: - f.write('flake8\n') + f.write('tox\n') with salt.utils.fopen(req2_filepath, 'w') as f: f.write('pep8\n') diff --git a/tests/integration/modules/test_pkg.py b/tests/integration/modules/test_pkg.py index b76f0af320..d760bc25ef 100644 --- a/tests/integration/modules/test_pkg.py +++ b/tests/integration/modules/test_pkg.py @@ -254,10 +254,10 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin): self.assertIn('bash-completion', keys) self.assertIn('dpkg', keys) elif os_family == 'RedHat': - ret = self.run_function(func, ['rpm', 'yum']) + ret = self.run_function(func, ['rpm', 'bash']) keys = ret.keys() self.assertIn('rpm', keys) - self.assertIn('yum', keys) + self.assertIn('bash', keys) elif os_family == 'Suse': ret = self.run_function(func, ['less', 'zypper']) keys = ret.keys() diff --git a/tests/unit/grains/test_core.py b/tests/unit/grains/test_core.py index a24c6d982e..362c094003 100644 --- a/tests/unit/grains/test_core.py +++ b/tests/unit/grains/test_core.py @@ -493,10 +493,11 @@ PATCHLEVEL = 3 log.debug( 'Testing Docker cgroup substring \'%s\'', cgroup_substr) with patch('salt.utils.fopen', mock_open(read_data=cgroup_data)): - self.assertEqual( - core._virtual({'kernel': 'Linux'}).get('virtual_subtype'), - 'Docker' - ) + with patch.dict(core.__salt__, {'cmd.run_all': MagicMock()}): + self.assertEqual( + core._virtual({'kernel': 'Linux'}).get('virtual_subtype'), + 'Docker' + ) def _check_ipaddress(self, value, ip_v): '''