Merge branch '2018.3' into bp-50230

This commit is contained in:
Nicole Thomas 2018-10-30 12:26:15 -04:00 committed by GitHub
commit 1aae681229
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 35 additions and 30 deletions

View file

@ -1,6 +1,6 @@
---
<% vagrant = system('gem list -i kitchen-vagrant 2>/dev/null >/dev/null') %>
<% version = '2017.7.8' %>
<% version = '2018.3.3' %>
<% platformsfile = ENV['SALT_KITCHEN_PLATFORMS'] || '.kitchen/platforms.yml' %>
<% driverfile = ENV['SALT_KITCHEN_DRIVER'] || '.kitchen/driver.yml' %>
<% verifierfile = ENV['SALT_KITCHEN_VERIFIER'] || '.kitchen/verifier.yml' %>

View file

@ -18,7 +18,6 @@ from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import copy
import fnmatch
import os
import re
import logging
@ -322,6 +321,7 @@ def latest_version(*names, **kwargs):
return ret[names[0]]
return ret
# available_version is being deprecated
available_version = salt.utils.functools.alias_function(latest_version, 'available_version')
@ -1659,8 +1659,15 @@ def list_repo_pkgs(*args, **kwargs): # pylint: disable=unused-import
salt '*' pkg.list_repo_pkgs
salt '*' pkg.list_repo_pkgs foo bar baz
'''
if args:
# Get only information about packages in args
cmd = ['apt-cache', 'show'] + [arg for arg in args]
else:
# Get information about all available packages
cmd = ['apt-cache', 'dump']
out = __salt__['cmd.run_all'](
['apt-cache', 'dump'],
cmd,
output_loglevel='trace',
ignore_retcode=True,
python_shell=False
@ -1671,6 +1678,8 @@ def list_repo_pkgs(*args, **kwargs): # pylint: disable=unused-import
skip_pkg = False
new_pkg = re.compile('^Package: (.+)')
for line in salt.utils.itertools.split(out['stdout'], '\n'):
if not line.strip():
continue
try:
cur_pkg = new_pkg.match(line).group(1)
except AttributeError:
@ -1678,22 +1687,10 @@ def list_repo_pkgs(*args, **kwargs): # pylint: disable=unused-import
else:
if cur_pkg != pkg_name:
pkg_name = cur_pkg
if args:
for arg in args:
if fnmatch.fnmatch(pkg_name, arg):
skip_pkg = False
break
else:
# Package doesn't match any of the passed args, skip it
skip_pkg = True
else:
# No args passed, we're getting all packages
skip_pkg = False
continue
if not skip_pkg:
comps = line.strip().split(None, 1)
if comps[0] == 'Version:':
ret.setdefault(pkg_name, []).append(comps[1])
comps = line.strip().split(None, 1)
if comps[0] == 'Version:':
ret.setdefault(pkg_name, []).append(comps[1])
return ret

View file

@ -79,6 +79,8 @@ def _localectl_status():
ctl_key = ctl_key.strip().lower().replace(' ', '_')
else:
ctl_data = line.strip()
if not ctl_data:
continue
if ctl_key:
if '=' in ctl_data:
loc_set = ctl_data.split('=')

View file

@ -906,9 +906,9 @@ def route_table_present(name, vpc_name=None, vpc_id=None, routes=None,
interface_id: eni-123456
- destination_cidr_block: 10.10.13.0/24
instance_name: mygatewayserver
- subnet_names:
- subnet1
- subnet2
- subnet_names:
- subnet1
- subnet2
name
Name of the route table.

View file

@ -46,10 +46,15 @@ except ImportError:
if HAS_PIP is True:
try:
from pip.req import InstallRequirement
_from_line = InstallRequirement.from_line
except ImportError:
# pip 10.0.0 move req module under pip._internal
try:
from pip._internal.req import InstallRequirement
try:
from pip._internal.req import InstallRequirement
_from_line = InstallRequirement.from_line
except AttributeError:
from pip._internal.req.constructors import install_req_from_line as _from_line
except ImportError:
HAS_PIP = False
# Remove references to the loaded pip module above so reloading works
@ -137,7 +142,7 @@ def _check_pkg_version_format(pkg):
# The next line is meant to trigger an AttributeError and
# handle lower pip versions
log.debug('Installed pip version: %s', pip.__version__)
install_req = InstallRequirement.from_line(pkg)
install_req = _from_line(pkg)
except AttributeError:
log.debug('Installed pip version is lower than 1.2')
supported_vcs = ('git', 'svn', 'hg', 'bzr')
@ -145,12 +150,12 @@ def _check_pkg_version_format(pkg):
for vcs in supported_vcs:
if pkg.startswith(vcs):
from_vcs = True
install_req = InstallRequirement.from_line(
install_req = _from_line(
pkg.split('{0}+'.format(vcs))[-1]
)
break
else:
install_req = InstallRequirement.from_line(pkg)
install_req = _from_line(pkg)
except (ValueError, InstallationError) as exc:
ret['result'] = False
if not from_vcs and '=' in pkg and '==' not in pkg:

View file

@ -99,11 +99,10 @@ class EC2Test(ShellCase):
key = config[profile_str][PROVIDER_NAME]['key']
key_name = config[profile_str][PROVIDER_NAME]['keyname']
sec_group = config[profile_str][PROVIDER_NAME]['securitygroupname'][0]
subnet_id = config[profile_str][PROVIDER_NAME]['subnet_id']
private_key = config[profile_str][PROVIDER_NAME]['private_key']
location = config[profile_str][PROVIDER_NAME]['location']
conf_items = [id_, key, key_name, sec_group, subnet_id, private_key, location]
conf_items = [id_, key, key_name, sec_group, private_key, location]
missing_conf_item = []
for item in conf_items:
@ -112,7 +111,7 @@ class EC2Test(ShellCase):
if missing_conf_item:
self.skipTest(
'An id, key, keyname, security group, subnet id, private key, and location must '
'An id, key, keyname, security group, private key, and location must '
'be provided to run these tests. One or more of these elements is '
'missing. Check tests/integration/files/conf/cloud.providers.d/{0}.conf'
.format(PROVIDER_NAME)

View file

@ -3,5 +3,5 @@
def myfunction():
grains = {}
grains['a_custom'] = {'k1': 'v1'}
grains['match'] = 'maker'
return grains

View file

@ -41,9 +41,11 @@ class LocalemodTestCase(TestCase, LoaderModuleMockMixin):
X11 Model: pc105
'''
locale_ctl_notset = '''
System Locale: n/a
System Locale: n/a
VC Keymap: n/a
X11 Layout: n/a
X11 Model: n/a
'''
locale_ctl_out_empty = ''
locale_ctl_out_broken = '''