mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +00:00
Merge branch '2017.7' into 'develop'
Conflicts: - salt/client/mixins.py - salt/fileclient.py - salt/modules/status.py - tests/integration/states/test_npm.py
This commit is contained in:
commit
78e744bda4
@ -33,6 +33,10 @@ Output Options
|
||||
|
||||
Write the output to the specified file.
|
||||
|
||||
.. option:: --out-file-append, --output-file-append
|
||||
|
||||
Append the output to the specified file.
|
||||
|
||||
.. option:: --no-color
|
||||
|
||||
Disable all colored output
|
||||
@ -46,3 +50,14 @@ Output Options
|
||||
|
||||
``green`` denotes success, ``red`` denotes failure, ``blue`` denotes
|
||||
changes and success and ``yellow`` denotes a expected future change in configuration.
|
||||
|
||||
.. option:: --state-output=STATE_OUTPUT, --state_output=STATE_OUTPUT
|
||||
|
||||
Override the configured state_output value for minion
|
||||
output. One of 'full', 'terse', 'mixed', 'changes' or
|
||||
'filter'. Default: 'none'.
|
||||
|
||||
.. option:: --state-verbose=STATE_VERBOSE, --state_verbose=STATE_VERBOSE
|
||||
|
||||
Override the configured state_verbose value for minion
|
||||
output. Set to True or False. Default: none.
|
||||
|
154
doc/topics/installation/eos.rst
Normal file
154
doc/topics/installation/eos.rst
Normal file
@ -0,0 +1,154 @@
|
||||
=========================================
|
||||
Arista EOS Salt minion installation guide
|
||||
=========================================
|
||||
|
||||
The Salt minion for Arista EOS is distributed as a SWIX extension and can be installed directly on the switch. The EOS network operating system is based on old Fedora distributions and the installation of the ``salt-minion`` requires backports. This SWIX extension contains the necessary backports, together with the Salt basecode.
|
||||
|
||||
.. note::
|
||||
|
||||
This SWIX extension has been tested on Arista DCS-7280SE-68-R, running EOS 4.17.5M and vEOS 4.18.3F.
|
||||
|
||||
Important Notes
|
||||
===============
|
||||
|
||||
This package is in beta, make sure to test it carefully before running it in production.
|
||||
|
||||
If confirmed working correctly, please report and add a note on this page with the platform model and EOS version.
|
||||
|
||||
If you want to uninstall this package, please refer to the uninstalling_ section.
|
||||
|
||||
Installation from the Official SaltStack Repository
|
||||
===================================================
|
||||
|
||||
Download the swix package and save it to flash.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
veos#copy https://salt-eos.netops.life/salt-eos-latest.swix flash:
|
||||
veos#copy https://salt-eos.netops.life/startup.sh flash:
|
||||
|
||||
Install the Extension
|
||||
=====================
|
||||
|
||||
Copy the Salt package to extension
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
veos#copy flash:salt-eos-latest.swix extension:
|
||||
|
||||
Install the SWIX
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
veos#extension salt-eos-latest.swix force
|
||||
|
||||
Verify the installation
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
veos#show extensions | include salt-eos
|
||||
salt-eos-2017-07-19.swix 1.0.11/1.fc25 A, F 27
|
||||
|
||||
Change the Salt master IP address or FQDN, by edit the variable (SALT_MASTER)
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
veos#bash vi /mnt/flash/startup.sh
|
||||
|
||||
Make sure you enable the eAPI with unix-socket
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
veos(config)#management api http-commands
|
||||
protocol unix-socket
|
||||
no shutdown
|
||||
|
||||
Post-installation tasks
|
||||
=======================
|
||||
|
||||
Generate Keys and host record and start Salt minion
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
veos#bash
|
||||
#sudo /mnt/flash/startup.sh
|
||||
|
||||
``salt-minion`` should be running
|
||||
|
||||
Copy the installed extensions to boot-extensions
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
veos#copy installed-extensions boot-extensions
|
||||
|
||||
Apply event-handler to let EOS start salt-minion during boot-up
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
veos(config)#event-handler boot-up-script
|
||||
trigger on-boot
|
||||
action bash sudo /mnt/flash/startup.sh
|
||||
|
||||
For more specific installation details of the ``salt-minion``, please refer to :ref:`Configuring Salt<configuring-salt>`.
|
||||
|
||||
.. _uninstalling:
|
||||
|
||||
Uninstalling
|
||||
============
|
||||
|
||||
If you decide to uninstall this package, the following steps are recommended for safety:
|
||||
|
||||
1. Remove the extension from boot-extensions
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
veos#bash rm /mnt/flash/boot-extensions
|
||||
|
||||
2. Remove the extension from extensions folder
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
veos#bash rm /mnt/flash/.extensions/salt-eos-latest.swix
|
||||
|
||||
2. Remove boot-up script
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
veos(config)#no event-handler boot-up-script
|
||||
|
||||
Additional Information
|
||||
======================
|
||||
|
||||
This SWIX extension contains the following RPM packages:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
libsodium-1.0.11-1.fc25.i686.rpm
|
||||
libstdc++-6.2.1-2.fc25.i686.rpm
|
||||
openpgm-5.2.122-6.fc24.i686.rpm
|
||||
python-Jinja2-2.8-0.i686.rpm
|
||||
python-PyYAML-3.12-0.i686.rpm
|
||||
python-babel-0.9.6-5.fc18.noarch.rpm
|
||||
python-backports-1.0-3.fc18.i686.rpm
|
||||
python-backports-ssl_match_hostname-3.4.0.2-1.fc18.noarch.rpm
|
||||
python-backports_abc-0.5-0.i686.rpm
|
||||
python-certifi-2016.9.26-0.i686.rpm
|
||||
python-chardet-2.0.1-5.fc18.noarch.rpm
|
||||
python-crypto-1.4.1-1.noarch.rpm
|
||||
python-crypto-2.6.1-1.fc18.i686.rpm
|
||||
python-futures-3.1.1-1.noarch.rpm
|
||||
python-jtextfsm-0.3.1-0.noarch.rpm
|
||||
python-kitchen-1.1.1-2.fc18.noarch.rpm
|
||||
python-markupsafe-0.18-1.fc18.i686.rpm
|
||||
python-msgpack-python-0.4.8-0.i686.rpm
|
||||
python-napalm-base-0.24.3-1.noarch.rpm
|
||||
python-napalm-eos-0.6.0-1.noarch.rpm
|
||||
python-netaddr-0.7.18-0.noarch.rpm
|
||||
python-pyeapi-0.7.0-0.noarch.rpm
|
||||
python-salt-2017.7.0_1414_g2fb986f-1.noarch.rpm
|
||||
python-singledispatch-3.4.0.3-0.i686.rpm
|
||||
python-six-1.10.0-0.i686.rpm
|
||||
python-tornado-4.4.2-0.i686.rpm
|
||||
python-urllib3-1.5-7.fc18.noarch.rpm
|
||||
python2-zmq-15.3.0-2.fc25.i686.rpm
|
||||
zeromq-4.1.4-5.fc25.i686.rpm
|
@ -46,6 +46,7 @@ These guides go into detail how to install Salt on a given platform.
|
||||
|
||||
arch
|
||||
debian
|
||||
eos
|
||||
fedora
|
||||
freebsd
|
||||
gentoo
|
||||
|
@ -166,13 +166,15 @@ Ubuntu 14.04 LTS and Debian Wheezy (7.x) also have a compatible version packaged
|
||||
|
||||
# apt-get install python-git
|
||||
|
||||
If your master is running an older version (such as Ubuntu 12.04 LTS or Debian
|
||||
Squeeze), then you will need to install GitPython using either pip_ or
|
||||
easy_install (it is recommended to use pip). Version 0.3.2.RC1 is now marked as
|
||||
the stable release in PyPI, so it should be a simple matter of running ``pip
|
||||
install GitPython`` (or ``easy_install GitPython``) as root.
|
||||
GitPython_ requires the ``git`` CLI utility to work. If installed from a system
|
||||
package, then git should already be installed, but if installed via pip_ then
|
||||
it may still be necessary to install git separately. For MacOS users,
|
||||
GitPython_ comes bundled in with the Salt installer, but git must still be
|
||||
installed for it to work properly. Git can be installed in several ways,
|
||||
including by installing XCode_.
|
||||
|
||||
.. _`pip`: http://www.pip-installer.org/
|
||||
.. _pip: http://www.pip-installer.org/
|
||||
.. _XCode: https://developer.apple.com/xcode/
|
||||
|
||||
.. warning::
|
||||
|
||||
|
@ -110,7 +110,7 @@ To pass through a file that contains jinja + yaml templating (the default):
|
||||
method='POST',
|
||||
data_file='/srv/salt/somefile.jinja',
|
||||
data_render=True,
|
||||
template_data={'key1': 'value1', 'key2': 'value2'}
|
||||
template_dict={'key1': 'value1', 'key2': 'value2'}
|
||||
)
|
||||
|
||||
To pass through a file that contains mako templating:
|
||||
@ -123,7 +123,7 @@ To pass through a file that contains mako templating:
|
||||
data_file='/srv/salt/somefile.mako',
|
||||
data_render=True,
|
||||
data_renderer='mako',
|
||||
template_data={'key1': 'value1', 'key2': 'value2'}
|
||||
template_dict={'key1': 'value1', 'key2': 'value2'}
|
||||
)
|
||||
|
||||
Because this function uses Salt's own rendering system, any Salt renderer can
|
||||
@ -140,7 +140,7 @@ However, this can be changed to ``master`` if necessary.
|
||||
method='POST',
|
||||
data_file='/srv/salt/somefile.jinja',
|
||||
data_render=True,
|
||||
template_data={'key1': 'value1', 'key2': 'value2'},
|
||||
template_dict={'key1': 'value1', 'key2': 'value2'},
|
||||
opts=__opts__
|
||||
)
|
||||
|
||||
@ -149,7 +149,7 @@ However, this can be changed to ``master`` if necessary.
|
||||
method='POST',
|
||||
data_file='/srv/salt/somefile.jinja',
|
||||
data_render=True,
|
||||
template_data={'key1': 'value1', 'key2': 'value2'},
|
||||
template_dict={'key1': 'value1', 'key2': 'value2'},
|
||||
node='master'
|
||||
)
|
||||
|
||||
@ -170,11 +170,11 @@ a Python dict.
|
||||
header_file='/srv/salt/headers.jinja',
|
||||
header_render=True,
|
||||
header_renderer='jinja',
|
||||
template_data={'key1': 'value1', 'key2': 'value2'}
|
||||
template_dict={'key1': 'value1', 'key2': 'value2'}
|
||||
)
|
||||
|
||||
Because much of the data that would be templated between headers and data may be
|
||||
the same, the ``template_data`` is the same for both. Correcting possible
|
||||
the same, the ``template_dict`` is the same for both. Correcting possible
|
||||
variable name collisions is up to the user.
|
||||
|
||||
Authentication
|
||||
|
@ -7,7 +7,7 @@ CherryPy==11.0.0
|
||||
click==6.7
|
||||
enum34==1.1.6
|
||||
gitdb==0.6.4
|
||||
GitPython==2.1.5
|
||||
GitPython==2.1.1
|
||||
idna==2.5
|
||||
ipaddress==1.0.18
|
||||
Jinja2==2.9.6
|
||||
|
@ -407,8 +407,6 @@ class SyncClientMixin(object):
|
||||
)
|
||||
data[u'success'] = False
|
||||
|
||||
namespaced_event.fire_event(data, u'ret')
|
||||
|
||||
if self.store_job:
|
||||
try:
|
||||
salt.utils.job.store_job(
|
||||
@ -426,6 +424,9 @@ class SyncClientMixin(object):
|
||||
log.error(u'Could not store job cache info. '
|
||||
u'Job details for this run may be unavailable.')
|
||||
|
||||
# Outputters _can_ mutate data so write to the job cache first!
|
||||
namespaced_event.fire_event(data, u'ret')
|
||||
|
||||
# if we fired an event, make sure to delete the event object.
|
||||
# This will ensure that we call destroy, which will do the 0MQ linger
|
||||
log.info(u'Runner completed: %s', data[u'jid'])
|
||||
|
@ -2334,7 +2334,7 @@ def syndic_config(master_config_path,
|
||||
'pki_dir', 'cachedir', 'pidfile', 'sock_dir', 'extension_modules',
|
||||
'autosign_file', 'autoreject_file', 'token_dir'
|
||||
]
|
||||
for config_key in ('syndic_log_file', 'log_file', 'key_logfile'):
|
||||
for config_key in ('log_file', 'key_logfile', 'syndic_log_file'):
|
||||
# If this is not a URI and instead a local path
|
||||
if urlparse(opts.get(config_key, '')).scheme == '':
|
||||
prepend_root_dirs.append(config_key)
|
||||
|
@ -1286,7 +1286,7 @@ class RemoteClient(Client):
|
||||
u'specified file %s is not present to generate hash: %s',
|
||||
path, err
|
||||
)
|
||||
return {}
|
||||
return {}, None
|
||||
else:
|
||||
ret = {}
|
||||
hash_type = self.opts.get(u'hash_type', u'md5')
|
||||
|
@ -1955,7 +1955,7 @@ def list_policy_versions(policy_name,
|
||||
return ret.get('list_policy_versions_response', {}).get('list_policy_versions_result', {}).get('versions')
|
||||
except boto.exception.BotoServerError as e:
|
||||
log.debug(e)
|
||||
msg = 'Failed to list {0} policy vesions.'
|
||||
msg = 'Failed to list {0} policy versions.'
|
||||
log.error(msg.format(policy_name))
|
||||
return []
|
||||
|
||||
|
@ -35,8 +35,6 @@ def useradd(pwfile, user, password, opts='', runas=None):
|
||||
Add a user to htpasswd file using the htpasswd command. If the htpasswd
|
||||
file does not exist, it will be created.
|
||||
|
||||
.. deprecated:: 2016.3.0
|
||||
|
||||
pwfile
|
||||
Path to htpasswd file
|
||||
|
||||
|
@ -56,6 +56,14 @@ try:
|
||||
except ImportError:
|
||||
HAS_LIBS = False
|
||||
|
||||
try:
|
||||
# There is an API change in Kubernetes >= 2.0.0.
|
||||
from kubernetes.client import V1beta1Deployment as AppsV1beta1Deployment
|
||||
from kubernetes.client import V1beta1DeploymentSpec as AppsV1beta1DeploymentSpec
|
||||
except ImportError:
|
||||
from kubernetes.client import AppsV1beta1Deployment
|
||||
from kubernetes.client import AppsV1beta1DeploymentSpec
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -876,7 +884,7 @@ def create_deployment(
|
||||
'''
|
||||
body = __create_object_body(
|
||||
kind='Deployment',
|
||||
obj_class=kubernetes.client.V1beta1Deployment,
|
||||
obj_class=AppsV1beta1Deployment,
|
||||
spec_creator=__dict_to_deployment_spec,
|
||||
name=name,
|
||||
namespace=namespace,
|
||||
@ -1139,7 +1147,7 @@ def replace_deployment(name,
|
||||
'''
|
||||
body = __create_object_body(
|
||||
kind='Deployment',
|
||||
obj_class=kubernetes.client.V1beta1Deployment,
|
||||
obj_class=AppsV1beta1Deployment,
|
||||
spec_creator=__dict_to_deployment_spec,
|
||||
name=name,
|
||||
namespace=namespace,
|
||||
@ -1410,9 +1418,9 @@ def __dict_to_object_meta(name, namespace, metadata):
|
||||
|
||||
def __dict_to_deployment_spec(spec):
|
||||
'''
|
||||
Converts a dictionary into kubernetes V1beta1DeploymentSpec instance.
|
||||
Converts a dictionary into kubernetes AppsV1beta1DeploymentSpec instance.
|
||||
'''
|
||||
spec_obj = kubernetes.client.V1beta1DeploymentSpec()
|
||||
spec_obj = AppsV1beta1DeploymentSpec()
|
||||
for key, value in iteritems(spec):
|
||||
if hasattr(spec_obj, key):
|
||||
setattr(spec_obj, key, value)
|
||||
|
@ -219,7 +219,7 @@ def uptime():
|
||||
with salt.utils.files.fopen(ut_path) as rfh:
|
||||
seconds = int(float(rfh.read().split()[0]))
|
||||
elif salt.utils.platform.is_sunos():
|
||||
# note: some flavors/vesions report the host uptime inside a zone
|
||||
# note: some flavors/versions report the host uptime inside a zone
|
||||
# https://support.oracle.com/epmos/faces/BugDisplay?id=15611584
|
||||
res = __salt__['cmd.run_all']('kstat -p unix:0:system_misc:boot_time')
|
||||
if res['retcode'] > 0:
|
||||
|
@ -948,27 +948,63 @@ def install(name=None, refresh=False, pkgs=None, **kwargs):
|
||||
packages listed under ``pkgs`` will be installed via a single
|
||||
command.
|
||||
|
||||
You can specify a version by passing the item as a dict:
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# will install the latest version of foo and bar
|
||||
salt '*' pkg.install pkgs='["foo", "bar"]'
|
||||
|
||||
# will install the latest version of foo and version 1.2.3 of bar
|
||||
salt '*' pkg.install pkgs='["foo", {"bar": "1.2.3"}]'
|
||||
|
||||
Kwargs:
|
||||
|
||||
version (str):
|
||||
The specific version to install. If omitted, the latest version
|
||||
will be installed. If passed with multiple install, the version
|
||||
will apply to all packages. Recommended for single installation
|
||||
only.
|
||||
The specific version to install. If omitted, the latest version will
|
||||
be installed. Recommend for use when installing a single package.
|
||||
|
||||
If passed with a list of packages in the ``pkgs`` parameter, the
|
||||
version will be ignored.
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Version is ignored
|
||||
salt '*' pkg.install pkgs="['foo', 'bar']" version=1.2.3
|
||||
|
||||
If passed with a comma seperated list in the ``name`` parameter, the
|
||||
version will apply to all packages in the list.
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Version 1.2.3 will apply to packages foo and bar
|
||||
salt '*' pkg.install foo,bar version=1.2.3
|
||||
|
||||
cache_file (str):
|
||||
A single file to copy down for use with the installer. Copied to
|
||||
the same location as the installer. Use this over ``cache_dir`` if
|
||||
there are many files in the directory and you only need a specific
|
||||
file and don't want to cache additional files that may reside in
|
||||
the installer directory. Only applies to files on ``salt://``
|
||||
A single file to copy down for use with the installer. Copied to the
|
||||
same location as the installer. Use this over ``cache_dir`` if there
|
||||
are many files in the directory and you only need a specific file
|
||||
and don't want to cache additional files that may reside in the
|
||||
installer directory. Only applies to files on ``salt://``
|
||||
|
||||
cache_dir (bool):
|
||||
True will copy the contents of the installer directory. This is
|
||||
useful for installations that are not a single file. Only applies
|
||||
to directories on ``salt://``
|
||||
useful for installations that are not a single file. Only applies to
|
||||
directories on ``salt://``
|
||||
|
||||
saltenv (str): Salt environment. Default 'base'
|
||||
extra_install_flags (str):
|
||||
Additional install flags that will be appended to the
|
||||
``install_flags`` defined in the software definition file. Only
|
||||
applies when single package is passed.
|
||||
|
||||
saltenv (str):
|
||||
Salt environment. Default 'base'
|
||||
|
||||
report_reboot_exit_codes (bool):
|
||||
If the installer exits with a recognized exit code indicating that
|
||||
@ -1064,13 +1100,22 @@ def install(name=None, refresh=False, pkgs=None, **kwargs):
|
||||
# "sources" argument
|
||||
pkg_params = __salt__['pkg_resource.parse_targets'](name, pkgs, **kwargs)[0]
|
||||
|
||||
if len(pkg_params) > 1:
|
||||
if kwargs.get('extra_install_flags') is not None:
|
||||
log.warning('\'extra_install_flags\' argument will be ignored for '
|
||||
'multiple package targets')
|
||||
|
||||
# Windows expects an Options dictionary containing 'version'
|
||||
for pkg in pkg_params:
|
||||
pkg_params[pkg] = {'version': pkg_params[pkg]}
|
||||
|
||||
if pkg_params is None or len(pkg_params) == 0:
|
||||
log.error('No package definition found')
|
||||
return {}
|
||||
|
||||
if not pkgs and len(pkg_params) == 1:
|
||||
# Only use the 'version' param if 'name' was not specified as a
|
||||
# comma-separated list
|
||||
# Only use the 'version' param if a single item was passed to the 'name'
|
||||
# parameter
|
||||
pkg_params = {
|
||||
name: {
|
||||
'version': kwargs.get('version'),
|
||||
|
@ -1,9 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Microsoft certificate management via the Pki PowerShell module.
|
||||
Microsoft certificate management via the PKI Client PowerShell module.
|
||||
https://technet.microsoft.com/en-us/itpro/powershell/windows/pkiclient/pkiclient
|
||||
|
||||
The PKI Client PowerShell module is only available on Windows 8+ and Windows
|
||||
Server 2012+.
|
||||
https://technet.microsoft.com/en-us/library/hh848636(v=wps.620).aspx
|
||||
|
||||
:platform: Windows
|
||||
|
||||
:depends:
|
||||
- PowerShell 4
|
||||
- PKI Client Module (Windows 8+ / Windows Server 2012+)
|
||||
|
||||
.. versionadded:: 2016.11.0
|
||||
'''
|
||||
# Import Python libs
|
||||
@ -29,11 +38,17 @@ __virtualname__ = 'win_pki'
|
||||
|
||||
def __virtual__():
|
||||
'''
|
||||
Only works on Windows systems with the PKI PowerShell module installed.
|
||||
Requires Windows
|
||||
Requires Windows 8+ / Windows Server 2012+
|
||||
Requires PowerShell
|
||||
Requires PKI Client PowerShell module installed.
|
||||
'''
|
||||
if not salt.utils.platform.is_windows():
|
||||
return False, 'Only available on Windows Systems'
|
||||
|
||||
if salt.utils.version_cmp(__grains__['osversion'], '6.2.9200') == -1:
|
||||
return False, 'Only available on Windows 8+ / Windows Server 2012 +'
|
||||
|
||||
if not __salt__['cmd.shell_info']('powershell')['installed']:
|
||||
return False, 'Powershell not available'
|
||||
|
||||
|
@ -358,6 +358,7 @@ class SPMClient(object):
|
||||
|
||||
# First we download everything, then we install
|
||||
for package in dl_list:
|
||||
out_file = dl_list[package]['dest_file']
|
||||
# Kick off the install
|
||||
self._install_indv_pkg(package, out_file)
|
||||
return
|
||||
|
@ -150,6 +150,13 @@ from salt.modules.cron import (
|
||||
)
|
||||
|
||||
|
||||
def __virtual__():
|
||||
if 'cron.list_tab' in __salt__:
|
||||
return True
|
||||
else:
|
||||
return (False, 'cron module could not be loaded')
|
||||
|
||||
|
||||
def _check_cron(user,
|
||||
cmd,
|
||||
minute=None,
|
||||
|
@ -1140,13 +1140,22 @@ def latest(name,
|
||||
password=password,
|
||||
https_user=https_user,
|
||||
https_pass=https_pass)
|
||||
comments.append(
|
||||
'Remote \'{0}\' changed from {1} to {2}'.format(
|
||||
remote,
|
||||
salt.utils.url.redact_http_basic_auth(fetch_url),
|
||||
redacted_fetch_url
|
||||
if fetch_url is None:
|
||||
comments.append(
|
||||
'Remote \'{0}\' set to {1}'.format(
|
||||
remote,
|
||||
redacted_fetch_url
|
||||
)
|
||||
)
|
||||
ret['changes']['new'] = name + ' => ' + remote
|
||||
else:
|
||||
comments.append(
|
||||
'Remote \'{0}\' changed from {1} to {2}'.format(
|
||||
remote,
|
||||
salt.utils.url.redact_http_basic_auth(fetch_url),
|
||||
redacted_fetch_url
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if remote_rev is not None:
|
||||
if __opts__['test']:
|
||||
|
@ -120,13 +120,13 @@ def volume_present(name, bricks, stripe=False, replica=False, device_vg=False,
|
||||
.. code-block:: yaml
|
||||
|
||||
myvolume:
|
||||
glusterfs.created:
|
||||
glusterfs.volume_present:
|
||||
- bricks:
|
||||
- host1:/srv/gluster/drive1
|
||||
- host2:/srv/gluster/drive2
|
||||
|
||||
Replicated Volume:
|
||||
glusterfs.created:
|
||||
glusterfs.volume_present:
|
||||
- name: volume2
|
||||
- bricks:
|
||||
- host1:/srv/gluster/drive2
|
||||
|
@ -1256,8 +1256,11 @@ def installed(
|
||||
|
||||
``NOTE:`` For :mod:`apt <salt.modules.aptpkg>`,
|
||||
:mod:`ebuild <salt.modules.ebuild>`,
|
||||
:mod:`pacman <salt.modules.pacman>`, :mod:`yumpkg <salt.modules.yumpkg>`,
|
||||
and :mod:`zypper <salt.modules.zypper>`, version numbers can be specified
|
||||
:mod:`pacman <salt.modules.pacman>`,
|
||||
:mod:`winrepo <salt.modules.win_pkg>`,
|
||||
:mod:`yumpkg <salt.modules.yumpkg>`, and
|
||||
:mod:`zypper <salt.modules.zypper>`,
|
||||
version numbers can be specified
|
||||
in the ``pkgs`` argument. For example:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
@ -311,6 +311,11 @@ def bootstrap(vm_, opts):
|
||||
}
|
||||
}
|
||||
|
||||
if vm_.get('driver') == 'saltify':
|
||||
saltify_driver = True
|
||||
else:
|
||||
saltify_driver = False
|
||||
|
||||
key_filename = salt.config.get_cloud_config_value(
|
||||
'key_filename', vm_, opts, search_global=False,
|
||||
default=salt.config.get_cloud_config_value(
|
||||
@ -478,6 +483,9 @@ def bootstrap(vm_, opts):
|
||||
'make_minion', vm_, opts, default=True
|
||||
)
|
||||
|
||||
if saltify_driver:
|
||||
deploy_kwargs['wait_for_passwd_maxtries'] = 0 # No need to wait/retry with Saltify
|
||||
|
||||
win_installer = salt.config.get_cloud_config_value(
|
||||
'win_installer', vm_, opts
|
||||
)
|
||||
@ -508,6 +516,8 @@ def bootstrap(vm_, opts):
|
||||
deploy_kwargs['winrm_verify_ssl'] = salt.config.get_cloud_config_value(
|
||||
'winrm_verify_ssl', vm_, opts, default=True
|
||||
)
|
||||
if saltify_driver:
|
||||
deploy_kwargs['port_timeout'] = 1 # No need to wait/retry with Saltify
|
||||
|
||||
# Store what was used to the deploy the VM
|
||||
event_kwargs = copy.deepcopy(deploy_kwargs)
|
||||
@ -815,21 +825,21 @@ def wait_for_winexesvc(host, port, username, password, timeout=900):
|
||||
log.debug('winexe connected...')
|
||||
return True
|
||||
log.debug('Return code was {0}'.format(ret_code))
|
||||
time.sleep(1)
|
||||
except socket.error as exc:
|
||||
log.debug('Caught exception in wait_for_winexesvc: {0}'.format(exc))
|
||||
time.sleep(1)
|
||||
if time.time() - start > timeout:
|
||||
log.error('winexe connection timed out: {0}'.format(timeout))
|
||||
return False
|
||||
log.debug(
|
||||
'Retrying winexe connection to host {0} on port {1} '
|
||||
'(try {2})'.format(
|
||||
host,
|
||||
port,
|
||||
try_count
|
||||
)
|
||||
|
||||
if time.time() - start > timeout:
|
||||
log.error('winexe connection timed out: {0}'.format(timeout))
|
||||
return False
|
||||
log.debug(
|
||||
'Retrying winexe connection to host {0} on port {1} '
|
||||
'(try {2})'.format(
|
||||
host,
|
||||
port,
|
||||
try_count
|
||||
)
|
||||
)
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def wait_for_winrm(host, port, username, password, timeout=900, use_ssl=True, verify=True):
|
||||
@ -864,19 +874,19 @@ def wait_for_winrm(host, port, username, password, timeout=900, use_ssl=True, ve
|
||||
log.debug('WinRM session connected...')
|
||||
return s
|
||||
log.debug('Return code was {0}'.format(r.status_code))
|
||||
time.sleep(1)
|
||||
except WinRMTransportError as exc:
|
||||
log.debug('Caught exception in wait_for_winrm: {0}'.format(exc))
|
||||
if time.time() - start > timeout:
|
||||
log.error('WinRM connection timed out: {0}'.format(timeout))
|
||||
return None
|
||||
log.debug(
|
||||
'Retrying WinRM connection to host {0} on port {1} '
|
||||
'(try {2})'.format(
|
||||
host, port, trycount
|
||||
)
|
||||
|
||||
if time.time() - start > timeout:
|
||||
log.error('WinRM connection timed out: {0}'.format(timeout))
|
||||
return None
|
||||
log.debug(
|
||||
'Retrying WinRM connection to host {0} on port {1} '
|
||||
'(try {2})'.format(
|
||||
host, port, trycount
|
||||
)
|
||||
time.sleep(1)
|
||||
)
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def validate_windows_cred(host,
|
||||
|
@ -240,7 +240,7 @@ def _get_service_instance(host, username, password, protocol,
|
||||
pwd=password,
|
||||
protocol=protocol,
|
||||
port=port,
|
||||
sslContext=ssl._create_unverified_context(),
|
||||
sslContext=getattr(ssl, '_create_unverified_context', getattr(ssl, '_create_stdlib_context'))(),
|
||||
b64token=token,
|
||||
mechanism=mechanism)
|
||||
else:
|
||||
|
@ -54,7 +54,6 @@ class AuthTest(ShellCase):
|
||||
group = 'saltops'
|
||||
|
||||
def setUp(self):
|
||||
# This is a little wasteful but shouldn't be a problem
|
||||
for user in (self.userA, self.userB):
|
||||
try:
|
||||
pwd.getpwnam(user)
|
||||
@ -68,6 +67,21 @@ class AuthTest(ShellCase):
|
||||
self.run_call('group.add {0}'.format(self.group))
|
||||
self.run_call('user.chgroups {0} {1} True'.format(self.userB, self.group))
|
||||
|
||||
def tearDown(self):
|
||||
for user in (self.userA, self.userB):
|
||||
try:
|
||||
pwd.getpwnam(user)
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
self.run_call('user.delete {0}'.format(user))
|
||||
try:
|
||||
grp.getgrnam(self.group)
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
self.run_call('group.delete {0}'.format(self.group))
|
||||
|
||||
def test_pam_auth_valid_user(self):
|
||||
'''
|
||||
test that pam auth mechanism works with a valid user
|
||||
@ -121,10 +135,3 @@ class AuthTest(ShellCase):
|
||||
self.assertTrue(
|
||||
'minion:' in resp
|
||||
)
|
||||
|
||||
def test_zzzz_tearDown(self):
|
||||
for user in (self.userA, self.userB):
|
||||
if pwd.getpwnam(user):
|
||||
self.run_call('user.delete {0}'.format(user))
|
||||
if grp.getgrnam(self.group):
|
||||
self.run_call('group.delete {0}'.format(self.group))
|
||||
|
@ -14,7 +14,11 @@ from tests.support.helpers import destructiveTest, requires_network
|
||||
from tests.support.mixins import SaltReturnAssertsMixin
|
||||
|
||||
# Import salt libs
|
||||
import salt.modules.cmdmod as cmd
|
||||
import salt.utils.path
|
||||
from salt.utils.versions import LooseVersion
|
||||
|
||||
MAX_NPM_VERSION = '5.0.0'
|
||||
|
||||
|
||||
@skipIf(salt.utils.path.which('npm') is None, 'npm not installed')
|
||||
@ -53,6 +57,8 @@ class NpmStateTest(ModuleCase, SaltReturnAssertsMixin):
|
||||
ret = self.run_state('npm.installed', name=None, pkgs=['pm2', 'grunt'])
|
||||
self.assertSaltTrueReturn(ret)
|
||||
|
||||
@skipIf(salt.utils.path.which('npm') and LooseVersion(cmd.run('npm -v')) >= LooseVersion(MAX_NPM_VERSION),
|
||||
'Skip with npm >= 5.0.0 until #41770 is fixed')
|
||||
@destructiveTest
|
||||
def test_npm_cache_clean(self):
|
||||
'''
|
||||
|
@ -16,28 +16,28 @@ except ImportError:
|
||||
HAS_BOTO = False
|
||||
|
||||
try:
|
||||
from moto import mock_ec2, mock_elb
|
||||
from moto import mock_ec2_deprecated, mock_elb_deprecated
|
||||
HAS_MOTO = True
|
||||
except ImportError:
|
||||
HAS_MOTO = False
|
||||
|
||||
def mock_ec2(self):
|
||||
def mock_ec2_deprecated(self):
|
||||
'''
|
||||
if the mock_ec2 function is not available due to import failure
|
||||
if the mock_ec2_deprecated function is not available due to import failure
|
||||
this replaces the decorated function with stub_function.
|
||||
Allows boto_vpc unit tests to use the @mock_ec2 decorator
|
||||
without a "NameError: name 'mock_ec2' is not defined" error.
|
||||
Allows boto_elb unit tests to use the @mock_ec2_deprecated decorator
|
||||
without a "NameError: name 'mock_ec2_deprecated' is not defined" error.
|
||||
'''
|
||||
def stub_function(self):
|
||||
pass
|
||||
return stub_function
|
||||
|
||||
def mock_elb(self):
|
||||
def mock_elb_deprecated(self):
|
||||
'''
|
||||
if the mock_ec2 function is not available due to import failure
|
||||
if the mock_elb_deprecated function is not available due to import failure
|
||||
this replaces the decorated function with stub_function.
|
||||
Allows boto_vpc unit tests to use the @mock_ec2 decorator
|
||||
without a "NameError: name 'mock_ec2' is not defined" error.
|
||||
Allows boto_elb unit tests to use the @mock_elb_deprecated decorator
|
||||
without a "NameError: name 'mock_elb_deprecated' is not defined" error.
|
||||
'''
|
||||
def stub_function(self):
|
||||
pass
|
||||
@ -114,8 +114,8 @@ class BotoElbTestCase(TestCase, LoaderModuleMockMixin):
|
||||
# __virtual__ must be caller in order for _get_conn to be injected
|
||||
boto_elb.__virtual__()
|
||||
|
||||
@mock_ec2
|
||||
@mock_elb
|
||||
@mock_ec2_deprecated
|
||||
@mock_elb_deprecated
|
||||
def test_register_instances_valid_id_result_true(self):
|
||||
'''
|
||||
tests that given a valid instance id and valid ELB that
|
||||
@ -133,8 +133,8 @@ class BotoElbTestCase(TestCase, LoaderModuleMockMixin):
|
||||
**conn_parameters)
|
||||
self.assertEqual(True, register_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_elb
|
||||
@mock_ec2_deprecated
|
||||
@mock_elb_deprecated
|
||||
def test_register_instances_valid_id_string(self):
|
||||
'''
|
||||
tests that given a string containing a instance id and valid ELB that
|
||||
@ -156,8 +156,8 @@ class BotoElbTestCase(TestCase, LoaderModuleMockMixin):
|
||||
log.debug(load_balancer_refreshed.instances)
|
||||
self.assertEqual([reservations.instances[0].id], registered_instance_ids)
|
||||
|
||||
@mock_ec2
|
||||
@mock_elb
|
||||
@mock_ec2_deprecated
|
||||
@mock_elb_deprecated
|
||||
def test_deregister_instances_valid_id_result_true(self):
|
||||
'''
|
||||
tests that given an valid id the boto_elb deregister_instances method
|
||||
@ -177,8 +177,8 @@ class BotoElbTestCase(TestCase, LoaderModuleMockMixin):
|
||||
**conn_parameters)
|
||||
self.assertEqual(True, deregister_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_elb
|
||||
@mock_ec2_deprecated
|
||||
@mock_elb_deprecated
|
||||
def test_deregister_instances_valid_id_string(self):
|
||||
'''
|
||||
tests that given an valid id the boto_elb deregister_instances method
|
||||
@ -203,8 +203,8 @@ class BotoElbTestCase(TestCase, LoaderModuleMockMixin):
|
||||
load_balancer_refreshed.instances]
|
||||
self.assertEqual(actual_instances, expected_instances)
|
||||
|
||||
@mock_ec2
|
||||
@mock_elb
|
||||
@mock_ec2_deprecated
|
||||
@mock_elb_deprecated
|
||||
def test_deregister_instances_valid_id_list(self):
|
||||
'''
|
||||
tests that given an valid ids in the form of a list that the boto_elb
|
||||
|
@ -29,17 +29,17 @@ except ImportError:
|
||||
HAS_BOTO = False
|
||||
|
||||
try:
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2_deprecated
|
||||
HAS_MOTO = True
|
||||
except ImportError:
|
||||
HAS_MOTO = False
|
||||
|
||||
def mock_ec2(self):
|
||||
def mock_ec2_deprecated(self):
|
||||
'''
|
||||
if the mock_ec2 function is not available due to import failure
|
||||
if the mock_ec2_deprecated function is not available due to import failure
|
||||
this replaces the decorated function with stub_function.
|
||||
Allows boto_secgroup unit tests to use the @mock_ec2 decorator
|
||||
without a "NameError: name 'mock_ec2' is not defined" error.
|
||||
Allows boto_secgroup unit tests to use the @mock_ec2_deprecated decorator
|
||||
without a "NameError: name 'mock_ec2_deprecated' is not defined" error.
|
||||
'''
|
||||
def stub_function(self):
|
||||
pass
|
||||
@ -117,7 +117,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
|
||||
{'to_port': 80, 'from_port': 80, 'ip_protocol': u'tcp', 'cidr_ip': u'0.0.0.0/0'}]
|
||||
self.assertEqual(boto_secgroup._split_rules(rules), split_rules)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_ec2_classic(self):
|
||||
'''
|
||||
Test of creation of an EC2-Classic security group. The test ensures
|
||||
@ -137,7 +137,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
|
||||
secgroup_created_group[0].vpc_id]
|
||||
self.assertEqual(expected_create_result, secgroup_create_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_ec2_vpc(self):
|
||||
'''
|
||||
test of creation of an EC2-VPC security group. The test ensures that a
|
||||
@ -155,7 +155,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
|
||||
secgroup_create_result = [secgroup_created_group[0].name, secgroup_created_group[0].description, secgroup_created_group[0].vpc_id]
|
||||
self.assertEqual(expected_create_result, secgroup_create_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_group_id_ec2_classic(self):
|
||||
'''
|
||||
tests that given a name of a group in EC2-Classic that the correct
|
||||
@ -177,7 +177,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
|
||||
|
||||
@skipIf(True, 'test skipped because moto does not yet support group'
|
||||
' filters https://github.com/spulec/moto/issues/154')
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_group_id_ec2_vpc(self):
|
||||
'''
|
||||
tests that given a name of a group in EC2-VPC that the correct
|
||||
@ -197,7 +197,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
|
||||
**conn_parameters)
|
||||
self.assertEqual(group_vpc.id, retrieved_group_id)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_config_single_rule_group_name(self):
|
||||
'''
|
||||
tests return of 'config' when given group name. get_config returns an OrderedDict.
|
||||
@ -213,7 +213,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
|
||||
group = conn.create_security_group(name=group_name, description=group_name)
|
||||
group.authorize(ip_protocol=ip_protocol, from_port=from_port, to_port=to_port, cidr_ip=cidr_ip)
|
||||
# setup the expected get_config result
|
||||
expected_get_config_result = OrderedDict([('name', group.name), ('group_id', group.id), ('owner_id', u'111122223333'),
|
||||
expected_get_config_result = OrderedDict([('name', group.name), ('group_id', group.id), ('owner_id', u'123456789012'),
|
||||
('description', group.description), ('tags', {}),
|
||||
('rules', [{'to_port': to_port, 'from_port': from_port,
|
||||
'ip_protocol': ip_protocol, 'cidr_ip': cidr_ip}]),
|
||||
@ -221,7 +221,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
|
||||
secgroup_get_config_result = boto_secgroup.get_config(group_id=group.id, **conn_parameters)
|
||||
self.assertEqual(expected_get_config_result, secgroup_get_config_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_exists_true_name_classic(self):
|
||||
'''
|
||||
tests 'true' existence of a group in EC2-Classic when given name
|
||||
@ -234,11 +234,11 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
|
||||
salt_exists_result = boto_secgroup.exists(name=group_name, **conn_parameters)
|
||||
self.assertTrue(salt_exists_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_exists_false_name_classic(self):
|
||||
pass
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_exists_true_name_vpc(self):
|
||||
'''
|
||||
tests 'true' existence of a group in EC2-VPC when given name and vpc_id
|
||||
@ -250,7 +250,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
|
||||
salt_exists_result = boto_secgroup.exists(name=group_name, vpc_id=vpc_id, **conn_parameters)
|
||||
self.assertTrue(salt_exists_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_exists_false_name_vpc(self):
|
||||
'''
|
||||
tests 'false' existence of a group in vpc when given name and vpc_id
|
||||
@ -259,7 +259,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
|
||||
salt_exists_result = boto_secgroup.exists(group_name, vpc_id=vpc_id, **conn_parameters)
|
||||
self.assertFalse(salt_exists_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_exists_true_group_id(self):
|
||||
'''
|
||||
tests 'true' existence of a group when given group_id
|
||||
@ -271,7 +271,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
|
||||
salt_exists_result = boto_secgroup.exists(group_id=group.id, **conn_parameters)
|
||||
self.assertTrue(salt_exists_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_exists_false_group_id(self):
|
||||
'''
|
||||
tests 'false' existence of a group when given group_id
|
||||
@ -280,7 +280,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
|
||||
salt_exists_result = boto_secgroup.exists(group_id=group_id, **conn_parameters)
|
||||
self.assertFalse(salt_exists_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_delete_group_ec2_classic(self):
|
||||
'''
|
||||
test deletion of a group in EC2-Classic. Test does the following:
|
||||
@ -306,11 +306,11 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
|
||||
actual_groups = [group.id for group in conn.get_all_security_groups()]
|
||||
self.assertEqual(expected_groups, actual_groups)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_delete_group_name_ec2_vpc(self):
|
||||
pass
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test__get_conn_true(self):
|
||||
'''
|
||||
tests ensures that _get_conn returns an boto.ec2.connection.EC2Connection object.
|
||||
|
@ -40,17 +40,17 @@ except ImportError:
|
||||
|
||||
try:
|
||||
import moto
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2_deprecated
|
||||
HAS_MOTO = True
|
||||
except ImportError:
|
||||
HAS_MOTO = False
|
||||
|
||||
def mock_ec2(self):
|
||||
def mock_ec2_deprecated(self):
|
||||
'''
|
||||
if the mock_ec2 function is not available due to import failure
|
||||
if the mock_ec2_deprecated function is not available due to import failure
|
||||
this replaces the decorated function with stub_function.
|
||||
Allows boto_vpc unit tests to use the @mock_ec2 decorator
|
||||
without a "NameError: name 'mock_ec2' is not defined" error.
|
||||
Allows boto_vpc unit tests to use the @mock_ec2_deprecated decorator
|
||||
without a "NameError: name 'mock_ec2_deprecated' is not defined" error.
|
||||
'''
|
||||
|
||||
def stub_function(self):
|
||||
@ -63,7 +63,7 @@ except ImportError:
|
||||
# which was added in boto 2.8.0
|
||||
# https://github.com/boto/boto/commit/33ac26b416fbb48a60602542b4ce15dcc7029f12
|
||||
required_boto_version = '2.8.0'
|
||||
required_moto_version = '0.3.7'
|
||||
required_moto_version = '1.0.0'
|
||||
|
||||
region = 'us-east-1'
|
||||
access_key = 'GKTADJGHEIQSXMKKRBJ08H'
|
||||
@ -272,7 +272,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
TestCase for salt.modules.boto_vpc module
|
||||
'''
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_checking_if_a_vpc_exists_by_id_and_a_vpc_exists_the_vpc_exists_method_returns_true(self):
|
||||
'''
|
||||
Tests checking vpc existence via id when the vpc already exists
|
||||
@ -283,7 +283,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(vpc_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_checking_if_a_vpc_exists_by_id_and_a_vpc_does_not_exist_the_vpc_exists_method_returns_false(
|
||||
self):
|
||||
'''
|
||||
@ -295,7 +295,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(vpc_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_checking_if_a_vpc_exists_by_name_and_a_vpc_exists_the_vpc_exists_method_returns_true(self):
|
||||
'''
|
||||
Tests checking vpc existence via name when vpc exists
|
||||
@ -306,7 +306,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(vpc_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_checking_if_a_vpc_exists_by_name_and_a_vpc_does_not_exist_the_vpc_exists_method_returns_false(
|
||||
self):
|
||||
'''
|
||||
@ -318,7 +318,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(vpc_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_checking_if_a_vpc_exists_by_tags_and_a_vpc_exists_the_vpc_exists_method_returns_true(self):
|
||||
'''
|
||||
Tests checking vpc existence via tag when vpc exists
|
||||
@ -329,7 +329,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(vpc_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_checking_if_a_vpc_exists_by_tags_and_a_vpc_does_not_exist_the_vpc_exists_method_returns_false(
|
||||
self):
|
||||
'''
|
||||
@ -341,7 +341,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(vpc_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_checking_if_a_vpc_exists_by_cidr_and_a_vpc_exists_the_vpc_exists_method_returns_true(self):
|
||||
'''
|
||||
Tests checking vpc existence via cidr when vpc exists
|
||||
@ -352,7 +352,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(vpc_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_checking_if_a_vpc_exists_by_cidr_and_a_vpc_does_not_exist_the_vpc_exists_method_returns_false(
|
||||
self):
|
||||
'''
|
||||
@ -364,7 +364,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(vpc_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_that_when_checking_if_a_vpc_exists_but_providing_no_filters_the_vpc_exists_method_raises_a_salt_invocation_error(self):
|
||||
'''
|
||||
@ -375,7 +375,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
'cidr or tags.'):
|
||||
boto_vpc.exists(**conn_parameters)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_vpc_id_method_when_filtering_by_name(self):
|
||||
'''
|
||||
Tests getting vpc id when filtering by name
|
||||
@ -386,7 +386,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertEqual(vpc.id, get_id_result['id'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_vpc_id_method_when_filtering_by_invalid_name(self):
|
||||
'''
|
||||
Tests getting vpc id when filtering by invalid name
|
||||
@ -397,7 +397,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertEqual(get_id_result['id'], None)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_vpc_id_method_when_filtering_by_cidr(self):
|
||||
'''
|
||||
Tests getting vpc id when filtering by cidr
|
||||
@ -408,7 +408,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertEqual(vpc.id, get_id_result['id'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_vpc_id_method_when_filtering_by_invalid_cidr(self):
|
||||
'''
|
||||
Tests getting vpc id when filtering by invalid cidr
|
||||
@ -419,7 +419,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertEqual(get_id_result['id'], None)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_vpc_id_method_when_filtering_by_tags(self):
|
||||
'''
|
||||
Tests getting vpc id when filtering by tags
|
||||
@ -430,7 +430,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertEqual(vpc.id, get_id_result['id'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_vpc_id_method_when_filtering_by_invalid_tags(self):
|
||||
'''
|
||||
Tests getting vpc id when filtering by invalid tags
|
||||
@ -441,7 +441,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertEqual(get_id_result['id'], None)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_get_vpc_id_method_when_not_providing_filters_raises_a_salt_invocation_error(self):
|
||||
'''
|
||||
@ -450,7 +450,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
with self.assertRaisesRegex(SaltInvocationError, 'At least one of the following must be provided: vpc_id, vpc_name, cidr or tags.'):
|
||||
boto_vpc.get_id(**conn_parameters)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_vpc_id_method_when_more_than_one_vpc_is_matched_raises_a_salt_command_execution_error(self):
|
||||
'''
|
||||
Tests getting vpc id but providing no filters
|
||||
@ -461,7 +461,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
with self.assertRaisesRegex(CommandExecutionError, 'Found more than one VPC matching the criteria.'):
|
||||
boto_vpc.get_id(cidr=u'10.0.0.0/24', **conn_parameters)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_a_vpc_succeeds_the_create_vpc_method_returns_true(self):
|
||||
'''
|
||||
tests True VPC created.
|
||||
@ -470,7 +470,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(vpc_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_a_vpc_and_specifying_a_vpc_name_succeeds_the_create_vpc_method_returns_true(self):
|
||||
'''
|
||||
tests True VPC created.
|
||||
@ -479,7 +479,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(vpc_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_a_vpc_and_specifying_tags_succeeds_the_create_vpc_method_returns_true(self):
|
||||
'''
|
||||
tests True VPC created.
|
||||
@ -488,7 +488,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(vpc_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_that_when_creating_a_vpc_fails_the_create_vpc_method_returns_false(self):
|
||||
'''
|
||||
@ -499,7 +499,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
self.assertFalse(vpc_creation_result['created'])
|
||||
self.assertTrue('error' in vpc_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_deleting_an_existing_vpc_the_delete_vpc_method_returns_true(self):
|
||||
'''
|
||||
Tests deleting an existing vpc
|
||||
@ -510,7 +510,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(vpc_deletion_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_deleting_a_non_existent_vpc_the_delete_vpc_method_returns_false(self):
|
||||
'''
|
||||
Tests deleting a non-existent vpc
|
||||
@ -519,7 +519,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(delete_vpc_result['deleted'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_describing_vpc_by_id_it_returns_the_dict_of_properties_returns_true(self):
|
||||
'''
|
||||
Tests describing parameters via vpc id if vpc exist
|
||||
@ -546,7 +546,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertEqual(describe_vpc, {'vpc': vpc_properties})
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_describing_vpc_by_id_it_returns_the_dict_of_properties_returns_false(self):
|
||||
'''
|
||||
Tests describing parameters via vpc id if vpc does not exist
|
||||
@ -557,7 +557,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(describe_vpc['vpc'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_that_when_describing_vpc_by_id_on_connection_error_it_returns_error(self):
|
||||
'''
|
||||
@ -570,7 +570,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
describe_result = boto_vpc.describe(vpc_id=vpc.id, **conn_parameters)
|
||||
self.assertTrue('error' in describe_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_describing_vpc_but_providing_no_vpc_id_the_describe_method_raises_a_salt_invocation_error(self):
|
||||
'''
|
||||
Tests describing vpc without vpc id
|
||||
@ -588,7 +588,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
.format(required_boto_version, _get_boto_version()))
|
||||
@skipIf(_has_required_moto() is False, 'The moto version must be >= to version {0}'.format(required_moto_version))
|
||||
class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_subnet_association_single_subnet(self):
|
||||
'''
|
||||
tests that given multiple subnet ids in the same VPC that the VPC ID is
|
||||
@ -601,7 +601,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
**conn_parameters)
|
||||
self.assertEqual(vpc.id, subnet_association['vpc_id'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_subnet_association_multiple_subnets_same_vpc(self):
|
||||
'''
|
||||
tests that given multiple subnet ids in the same VPC that the VPC ID is
|
||||
@ -614,7 +614,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
**conn_parameters)
|
||||
self.assertEqual(vpc.id, subnet_association['vpc_id'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_subnet_association_multiple_subnets_different_vpc(self):
|
||||
'''
|
||||
tests that given multiple subnet ids in different VPCs that False is
|
||||
@ -628,7 +628,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
**conn_parameters)
|
||||
self.assertEqual(set(subnet_association['vpc_ids']), set([vpc_a.id, vpc_b.id]))
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_a_subnet_succeeds_the_create_subnet_method_returns_true(self):
|
||||
'''
|
||||
Tests creating a subnet successfully
|
||||
@ -640,7 +640,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
self.assertTrue(subnet_creation_result['created'])
|
||||
self.assertTrue('id' in subnet_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_a_subnet_and_specifying_a_name_succeeds_the_create_subnet_method_returns_true(self):
|
||||
'''
|
||||
Tests creating a subnet successfully when specifying a name
|
||||
@ -651,7 +651,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(subnet_creation_result['created'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_a_subnet_and_specifying_tags_succeeds_the_create_subnet_method_returns_true(self):
|
||||
'''
|
||||
Tests creating a subnet successfully when specifying a tag
|
||||
@ -663,7 +663,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(subnet_creation_result['created'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_that_when_creating_a_subnet_fails_the_create_subnet_method_returns_error(self):
|
||||
'''
|
||||
@ -675,7 +675,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
subnet_creation_result = boto_vpc.create_subnet(vpc.id, '10.0.0.0/24', **conn_parameters)
|
||||
self.assertTrue('error' in subnet_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_deleting_an_existing_subnet_the_delete_subnet_method_returns_true(self):
|
||||
'''
|
||||
Tests deleting an existing subnet
|
||||
@ -687,7 +687,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(subnet_deletion_result['deleted'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_deleting_a_non_existent_subnet_the_delete_vpc_method_returns_false(self):
|
||||
'''
|
||||
Tests deleting a subnet that doesn't exist
|
||||
@ -695,7 +695,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
delete_subnet_result = boto_vpc.delete_subnet(subnet_id='1234', **conn_parameters)
|
||||
self.assertTrue('error' in delete_subnet_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_checking_if_a_subnet_exists_by_id_the_subnet_exists_method_returns_true(self):
|
||||
'''
|
||||
Tests checking if a subnet exists when it does exist
|
||||
@ -707,7 +707,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(subnet_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_a_subnet_does_not_exist_the_subnet_exists_method_returns_false(self):
|
||||
'''
|
||||
Tests checking if a subnet exists which doesn't exist
|
||||
@ -716,7 +716,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(subnet_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_checking_if_a_subnet_exists_by_name_the_subnet_exists_method_returns_true(self):
|
||||
'''
|
||||
Tests checking subnet existence by name
|
||||
@ -728,7 +728,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(subnet_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_checking_if_a_subnet_exists_by_name_the_subnet_does_not_exist_the_subnet_method_returns_false(self):
|
||||
'''
|
||||
Tests checking subnet existence by name when it doesn't exist
|
||||
@ -740,7 +740,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(subnet_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_checking_if_a_subnet_exists_by_tags_the_subnet_exists_method_returns_true(self):
|
||||
'''
|
||||
Tests checking subnet existence by tag
|
||||
@ -752,7 +752,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(subnet_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_checking_if_a_subnet_exists_by_tags_the_subnet_does_not_exist_the_subnet_method_returns_false(self):
|
||||
'''
|
||||
Tests checking subnet existence by tag when subnet doesn't exist
|
||||
@ -764,7 +764,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(subnet_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_that_when_checking_if_a_subnet_exists_but_providing_no_filters_the_subnet_exists_method_raises_a_salt_invocation_error(self):
|
||||
'''
|
||||
@ -776,7 +776,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
boto_vpc.subnet_exists(**conn_parameters)
|
||||
|
||||
@skipIf(True, 'Skip these tests while investigating failures')
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_describe_subnet_by_id_for_existing_subnet_returns_correct_data(self):
|
||||
'''
|
||||
Tests describing a subnet by id.
|
||||
@ -791,7 +791,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
self.assertEqual(set(describe_subnet_results['subnet'].keys()),
|
||||
set(['id', 'cidr_block', 'availability_zone', 'tags']))
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_describe_subnet_by_id_for_non_existent_subnet_returns_none(self):
|
||||
'''
|
||||
Tests describing a non-existent subnet by id.
|
||||
@ -805,7 +805,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
self.assertEqual(describe_subnet_results['subnet'], None)
|
||||
|
||||
@skipIf(True, 'Skip these tests while investigating failures')
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_describe_subnet_by_name_for_existing_subnet_returns_correct_data(self):
|
||||
'''
|
||||
Tests describing a subnet by name.
|
||||
@ -820,7 +820,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
self.assertEqual(set(describe_subnet_results['subnet'].keys()),
|
||||
set(['id', 'cidr_block', 'availability_zone', 'tags']))
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_describe_subnet_by_name_for_non_existent_subnet_returns_none(self):
|
||||
'''
|
||||
Tests describing a non-existent subnet by id.
|
||||
@ -834,7 +834,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
self.assertEqual(describe_subnet_results['subnet'], None)
|
||||
|
||||
@skipIf(True, 'Skip these tests while investigating failures')
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_describe_subnets_by_id_for_existing_subnet_returns_correct_data(self):
|
||||
'''
|
||||
Tests describing multiple subnets by id.
|
||||
@ -852,7 +852,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
set(['id', 'cidr_block', 'availability_zone', 'tags']))
|
||||
|
||||
@skipIf(True, 'Skip these tests while investigating failures')
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_describe_subnets_by_name_for_existing_subnets_returns_correct_data(self):
|
||||
'''
|
||||
Tests describing multiple subnets by id.
|
||||
@ -869,7 +869,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
self.assertEqual(set(describe_subnet_results['subnets'][0].keys()),
|
||||
set(['id', 'cidr_block', 'availability_zone', 'tags']))
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_subnet_passes_availability_zone(self):
|
||||
'''
|
||||
Tests that the availability_zone kwarg is passed on to _create_resource
|
||||
@ -890,7 +890,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
' or equal to version {}. Installed: {}'
|
||||
.format(required_boto_version, _get_boto_version()))
|
||||
class BotoVpcInternetGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_an_internet_gateway_the_create_internet_gateway_method_returns_true(self):
|
||||
'''
|
||||
Tests creating an internet gateway successfully (with no vpc id or name)
|
||||
@ -901,7 +901,7 @@ class BotoVpcInternetGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
keyid=access_key)
|
||||
self.assertTrue(igw_creation_result.get('created'))
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_an_internet_gateway_with_non_existent_vpc_the_create_internet_gateway_method_returns_an_error(self):
|
||||
'''
|
||||
Tests that creating an internet gateway for a non-existent VPC fails.
|
||||
@ -913,7 +913,7 @@ class BotoVpcInternetGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
vpc_name='non-existent-vpc')
|
||||
self.assertTrue('error' in igw_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_an_internet_gateway_with_vpc_name_specified_the_create_internet_gateway_method_returns_true(self):
|
||||
'''
|
||||
Tests creating an internet gateway with vpc name specified.
|
||||
@ -928,7 +928,7 @@ class BotoVpcInternetGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(igw_creation_result.get('created'))
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_an_internet_gateway_with_vpc_id_specified_the_create_internet_gateway_method_returns_true(self):
|
||||
'''
|
||||
Tests creating an internet gateway with vpc name specified.
|
||||
@ -951,7 +951,7 @@ class BotoVpcInternetGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
' or equal to version {}. Installed: {}'
|
||||
.format(required_boto_version, _get_boto_version()))
|
||||
class BotoVpcNatGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_an_nat_gateway_the_create_nat_gateway_method_returns_true(self):
|
||||
'''
|
||||
Tests creating an nat gateway successfully (with subnet_id specified)
|
||||
@ -965,7 +965,7 @@ class BotoVpcNatGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
keyid=access_key)
|
||||
self.assertTrue(ngw_creation_result.get('created'))
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_an_nat_gateway_with_non_existent_subnet_the_create_nat_gateway_method_returns_an_error(self):
|
||||
'''
|
||||
Tests that creating an nat gateway for a non-existent subnet fails.
|
||||
@ -977,7 +977,7 @@ class BotoVpcNatGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
subnet_name='non-existent-subnet')
|
||||
self.assertTrue('error' in ngw_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_an_nat_gateway_with_subnet_name_specified_the_create_nat_gateway_method_returns_true(self):
|
||||
'''
|
||||
Tests creating an nat gateway with subnet name specified.
|
||||
@ -1000,7 +1000,7 @@ class BotoVpcNatGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
' or equal to version {}. Installed: {}'
|
||||
.format(required_boto_version, _get_boto_version()))
|
||||
class BotoVpcCustomerGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_creating_a_customer_gateway_the_create_customer_gateway_method_returns_true(self):
|
||||
'''
|
||||
@ -1010,7 +1010,7 @@ class BotoVpcCustomerGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
gw_creation_result = boto_vpc.create_customer_gateway('ipsec.1', '10.1.1.1', None)
|
||||
self.assertTrue(gw_creation_result.get('created'))
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_checking_if_a_subnet_exists_by_id_the_subnet_exists_method_returns_true(self):
|
||||
'''
|
||||
@ -1021,7 +1021,7 @@ class BotoVpcCustomerGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
gw_exists_result = boto_vpc.customer_gateway_exists(customer_gateway_id=gw_creation_result['id'])
|
||||
self.assertTrue(gw_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_a_subnet_does_not_exist_the_subnet_exists_method_returns_false(self):
|
||||
'''
|
||||
@ -1039,7 +1039,7 @@ class BotoVpcCustomerGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
.format(required_boto_version, _get_boto_version()))
|
||||
@skipIf(_has_required_moto() is False, 'The moto version must be >= to version {0}'.format(required_moto_version))
|
||||
class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_dhcp_options_succeeds_the_create_dhcp_options_method_returns_true(self):
|
||||
'''
|
||||
Tests creating dhcp options successfully
|
||||
@ -1048,7 +1048,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(dhcp_options_creation_result['created'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_creating_dhcp_options_and_specifying_a_name_succeeds_the_create_dhcp_options_method_returns_true(
|
||||
self):
|
||||
@ -1060,7 +1060,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(dhcp_options_creation_result['created'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_dhcp_options_and_specifying_tags_succeeds_the_create_dhcp_options_method_returns_true(
|
||||
self):
|
||||
'''
|
||||
@ -1071,7 +1071,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(dhcp_options_creation_result['created'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_that_when_creating_dhcp_options_fails_the_create_dhcp_options_method_returns_error(self):
|
||||
'''
|
||||
@ -1082,7 +1082,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
r = dhcp_options_creation_result = boto_vpc.create_dhcp_options(**dhcp_options_parameters)
|
||||
self.assertTrue('error' in r)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_associating_an_existing_dhcp_options_set_to_an_existing_vpc_the_associate_dhcp_options_method_returns_true(
|
||||
self):
|
||||
'''
|
||||
@ -1096,7 +1096,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(dhcp_options_association_result['associated'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_associating_a_non_existent_dhcp_options_set_to_an_existing_vpc_the_associate_dhcp_options_method_returns_error(
|
||||
self):
|
||||
'''
|
||||
@ -1108,7 +1108,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue('error' in dhcp_options_association_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_associating_an_existing_dhcp_options_set_to_a_non_existent_vpc_the_associate_dhcp_options_method_returns_false(
|
||||
self):
|
||||
'''
|
||||
@ -1121,7 +1121,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue('error' in dhcp_options_association_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_dhcp_options_set_to_an_existing_vpc_succeeds_the_associate_new_dhcp_options_method_returns_true(
|
||||
self):
|
||||
'''
|
||||
@ -1133,7 +1133,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(dhcp_creation_result['created'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_that_when_creating_and_associating_dhcp_options_set_to_an_existing_vpc_fails_creating_the_dhcp_options_the_associate_new_dhcp_options_method_raises_exception(
|
||||
self):
|
||||
@ -1147,7 +1147,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
r = boto_vpc.associate_new_dhcp_options_to_vpc(vpc.id, **dhcp_options_parameters)
|
||||
self.assertTrue('error' in r)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_that_when_creating_and_associating_dhcp_options_set_to_an_existing_vpc_fails_associating_the_dhcp_options_the_associate_new_dhcp_options_method_raises_exception(self):
|
||||
'''
|
||||
@ -1160,7 +1160,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
r = boto_vpc.associate_new_dhcp_options_to_vpc(vpc.id, **dhcp_options_parameters)
|
||||
self.assertTrue('error' in r)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_dhcp_options_set_to_a_non_existent_vpc_the_dhcp_options_the_associate_new_dhcp_options_method_returns_false(
|
||||
self):
|
||||
'''
|
||||
@ -1170,7 +1170,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
r = boto_vpc.create_dhcp_options(vpc_name='fake', **dhcp_options_parameters)
|
||||
self.assertTrue('error' in r)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_dhcp_options_exists_the_dhcp_options_exists_method_returns_true(self):
|
||||
'''
|
||||
Tests existence of dhcp options successfully
|
||||
@ -1181,7 +1181,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(dhcp_options_exists_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_dhcp_options_do_not_exist_the_dhcp_options_exists_method_returns_false(self):
|
||||
'''
|
||||
Tests existence of dhcp options failure
|
||||
@ -1189,7 +1189,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
r = boto_vpc.dhcp_options_exists('fake', **conn_parameters)
|
||||
self.assertFalse(r['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_that_when_checking_if_dhcp_options_exists_but_providing_no_filters_the_dhcp_options_exists_method_raises_a_salt_invocation_error(self):
|
||||
'''
|
||||
@ -1206,7 +1206,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
' or equal to version {}. Installed: {}'
|
||||
.format(required_boto_version, _get_boto_version()))
|
||||
class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_network_acl_for_an_existing_vpc_the_create_network_acl_method_returns_true(self):
|
||||
'''
|
||||
Tests creation of network acl with existing vpc
|
||||
@ -1217,7 +1217,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(network_acl_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_network_acl_for_an_existing_vpc_and_specifying_a_name_the_create_network_acl_method_returns_true(
|
||||
self):
|
||||
'''
|
||||
@ -1229,7 +1229,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(network_acl_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_network_acl_for_an_existing_vpc_and_specifying_tags_the_create_network_acl_method_returns_true(
|
||||
self):
|
||||
'''
|
||||
@ -1241,7 +1241,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(network_acl_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_network_acl_for_a_non_existent_vpc_the_create_network_acl_method_returns_an_error(self):
|
||||
'''
|
||||
Tests creation of network acl with a non-existent vpc
|
||||
@ -1250,7 +1250,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue('error' in network_acl_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_creating_network_acl_fails_the_create_network_acl_method_returns_false(self):
|
||||
'''
|
||||
@ -1264,7 +1264,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(network_acl_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_deleting_an_existing_network_acl_the_delete_network_acl_method_returns_true(self):
|
||||
'''
|
||||
Tests deletion of existing network acl successfully
|
||||
@ -1276,7 +1276,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(network_acl_deletion_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_deleting_a_non_existent_network_acl_the_delete_network_acl_method_returns_an_error(self):
|
||||
'''
|
||||
Tests deleting a non-existent network acl
|
||||
@ -1285,7 +1285,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue('error' in network_acl_deletion_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_a_network_acl_exists_the_network_acl_exists_method_returns_true(self):
|
||||
'''
|
||||
Tests existence of network acl
|
||||
@ -1297,7 +1297,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(network_acl_deletion_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_a_network_acl_does_not_exist_the_network_acl_exists_method_returns_false(self):
|
||||
'''
|
||||
Tests checking network acl does not exist
|
||||
@ -1306,7 +1306,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(network_acl_deletion_result['exists'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_that_when_checking_if_network_acl_exists_but_providing_no_filters_the_network_acl_exists_method_raises_a_salt_invocation_error(self):
|
||||
'''
|
||||
@ -1318,7 +1318,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
):
|
||||
boto_vpc.dhcp_options_exists(**conn_parameters)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_creating_a_network_acl_entry_successfully_the_create_network_acl_entry_method_returns_true(self):
|
||||
'''
|
||||
@ -1333,7 +1333,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(network_acl_entry_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_creating_a_network_acl_entry_for_a_non_existent_network_acl_the_create_network_acl_entry_method_returns_false(
|
||||
self):
|
||||
@ -1345,7 +1345,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(network_acl_entry_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_replacing_a_network_acl_entry_successfully_the_replace_network_acl_entry_method_returns_true(
|
||||
self):
|
||||
@ -1362,7 +1362,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(network_acl_entry_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_replacing_a_network_acl_entry_for_a_non_existent_network_acl_the_replace_network_acl_entry_method_returns_false(
|
||||
self):
|
||||
@ -1373,7 +1373,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
**conn_parameters)
|
||||
self.assertFalse(network_acl_entry_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_deleting_an_existing_network_acl_entry_the_delete_network_acl_entry_method_returns_true(self):
|
||||
'''
|
||||
@ -1388,7 +1388,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(network_acl_entry_deletion_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_deleting_a_non_existent_network_acl_entry_the_delete_network_acl_entry_method_returns_false(
|
||||
self):
|
||||
@ -1400,7 +1400,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(network_acl_entry_deletion_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_associating_an_existing_network_acl_to_an_existing_subnet_the_associate_network_acl_method_returns_true(
|
||||
self):
|
||||
@ -1416,7 +1416,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(network_acl_association_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_associating_a_non_existent_network_acl_to_an_existing_subnet_the_associate_network_acl_method_returns_an_error(
|
||||
self):
|
||||
'''
|
||||
@ -1430,7 +1430,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue('error' in network_acl_association_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_associating_an_existing_network_acl_to_a_non_existent_subnet_the_associate_network_acl_method_returns_false(
|
||||
self):
|
||||
@ -1445,7 +1445,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(network_acl_association_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_creating_and_associating_a_network_acl_to_a_subnet_succeeds_the_associate_new_network_acl_to_subnet_method_returns_true(
|
||||
self):
|
||||
@ -1460,7 +1460,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(network_acl_creation_and_association_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_creating_and_associating_a_network_acl_to_a_subnet_and_specifying_a_name_succeeds_the_associate_new_network_acl_to_subnet_method_returns_true(
|
||||
self):
|
||||
@ -1476,7 +1476,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(network_acl_creation_and_association_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_creating_and_associating_a_network_acl_to_a_subnet_and_specifying_tags_succeeds_the_associate_new_network_acl_to_subnet_method_returns_true(
|
||||
self):
|
||||
@ -1493,7 +1493,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(network_acl_creation_and_association_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_creating_and_associating_a_network_acl_to_a_non_existent_subnet_the_associate_new_network_acl_to_subnet_method_returns_false(
|
||||
self):
|
||||
@ -1507,7 +1507,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(network_acl_creation_and_association_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_that_when_creating_a_network_acl_to_a_non_existent_vpc_the_associate_new_network_acl_to_subnet_method_returns_an_error(
|
||||
self):
|
||||
'''
|
||||
@ -1520,7 +1520,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue('error' in network_acl_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_disassociating_network_acl_succeeds_the_disassociate_network_acl_method_should_return_true(self):
|
||||
'''
|
||||
@ -1533,7 +1533,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(dhcp_disassociate_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_disassociating_network_acl_for_a_non_existent_vpc_the_disassociate_network_acl_method_should_return_false(
|
||||
self):
|
||||
@ -1547,7 +1547,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(dhcp_disassociate_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_disassociating_network_acl_for_a_non_existent_subnet_the_disassociate_network_acl_method_should_return_false(
|
||||
self):
|
||||
@ -1568,7 +1568,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
' or equal to version {}. Installed: {}'
|
||||
.format(required_boto_version, _get_boto_version()))
|
||||
class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_creating_a_route_table_succeeds_the_create_route_table_method_returns_true(self):
|
||||
'''
|
||||
@ -1580,7 +1580,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(route_table_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_creating_a_route_table_on_a_non_existent_vpc_the_create_route_table_method_returns_false(self):
|
||||
'''
|
||||
@ -1590,7 +1590,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(route_table_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_deleting_a_route_table_succeeds_the_delete_route_table_method_returns_true(self):
|
||||
'''
|
||||
@ -1603,7 +1603,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(route_table_deletion_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_deleting_a_non_existent_route_table_the_delete_route_table_method_returns_false(self):
|
||||
'''
|
||||
@ -1613,7 +1613,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(route_table_deletion_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_route_table_exists_the_route_table_exists_method_returns_true(self):
|
||||
'''
|
||||
@ -1626,7 +1626,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(route_table_existence_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_route_table_does_not_exist_the_route_table_exists_method_returns_false(self):
|
||||
'''
|
||||
@ -1636,7 +1636,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(route_table_existence_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_that_when_checking_if_a_route_table_exists_but_providing_no_filters_the_route_table_exists_method_raises_a_salt_invocation_error(self):
|
||||
'''
|
||||
@ -1648,7 +1648,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
):
|
||||
boto_vpc.dhcp_options_exists(**conn_parameters)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_associating_a_route_table_succeeds_the_associate_route_table_method_should_return_the_association_id(
|
||||
self):
|
||||
@ -1663,7 +1663,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(association_id)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_associating_a_route_table_with_a_non_existent_route_table_the_associate_route_table_method_should_return_false(
|
||||
self):
|
||||
@ -1677,7 +1677,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(association_id)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_associating_a_route_table_with_a_non_existent_subnet_the_associate_route_table_method_should_return_false(
|
||||
self):
|
||||
@ -1691,7 +1691,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(association_id)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_disassociating_a_route_table_succeeds_the_disassociate_route_table_method_should_return_true(
|
||||
self):
|
||||
@ -1708,7 +1708,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(dhcp_disassociate_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_creating_a_route_succeeds_the_create_route_method_should_return_true(self):
|
||||
'''
|
||||
@ -1721,7 +1721,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(route_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_creating_a_route_with_a_non_existent_route_table_the_create_route_method_should_return_false(
|
||||
self):
|
||||
@ -1732,7 +1732,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(route_creation_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_deleting_a_route_succeeds_the_delete_route_method_should_return_true(self):
|
||||
'''
|
||||
@ -1745,7 +1745,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(route_deletion_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_deleting_a_route_with_a_non_existent_route_table_the_delete_route_method_should_return_false(
|
||||
self):
|
||||
@ -1756,7 +1756,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertFalse(route_deletion_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_replacing_a_route_succeeds_the_replace_route_method_should_return_true(self):
|
||||
'''
|
||||
@ -1769,7 +1769,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
self.assertTrue(route_replacing_result)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Moto has not implemented this feature. Skipping for now.')
|
||||
def test_that_when_replacing_a_route_with_a_non_existent_route_table_the_replace_route_method_should_return_false(
|
||||
self):
|
||||
@ -1790,7 +1790,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
@skipIf(_has_required_moto() is False, 'The moto version must be >= to version {0}'.format(required_moto_version))
|
||||
class BotoVpcPeeringConnectionsTest(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_request_vpc_peering_connection(self):
|
||||
'''
|
||||
Run with 2 vpc ids and returns a message
|
||||
@ -1803,7 +1803,7 @@ class BotoVpcPeeringConnectionsTest(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
||||
peer_vpc_id=other_vpc.id,
|
||||
**conn_parameters))
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_raises_error_if_both_vpc_name_and_vpc_id_are_specified(self):
|
||||
'''
|
||||
Must specify only one
|
||||
|
@ -14,6 +14,7 @@ from tests.support.mock import NO_MOCK, NO_MOCK_REASON, patch
|
||||
import salt.config
|
||||
import salt.loader
|
||||
import salt.utils.boto
|
||||
from salt.ext import six
|
||||
from salt.utils.versions import LooseVersion
|
||||
import salt.states.boto_vpc as boto_vpc
|
||||
|
||||
@ -34,18 +35,18 @@ except ImportError:
|
||||
HAS_BOTO = False
|
||||
|
||||
try:
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2_deprecated
|
||||
|
||||
HAS_MOTO = True
|
||||
except ImportError:
|
||||
HAS_MOTO = False
|
||||
|
||||
def mock_ec2(self):
|
||||
def mock_ec2_deprecated(self):
|
||||
'''
|
||||
if the mock_ec2 function is not available due to import failure
|
||||
if the mock_ec2_deprecated function is not available due to import failure
|
||||
this replaces the decorated function with stub_function.
|
||||
Allows boto_vpc unit tests to use the @mock_ec2 decorator
|
||||
without a "NameError: name 'mock_ec2' is not defined" error.
|
||||
Allows boto_vpc unit tests to use the @mock_ec2_deprecated decorator
|
||||
without a "NameError: name 'mock_ec2_deprecated' is not defined" error.
|
||||
'''
|
||||
|
||||
def stub_function(self):
|
||||
@ -131,7 +132,7 @@ class BotoVpcTestCase(BotoVpcStateTestCaseBase, BotoVpcTestCaseMixin):
|
||||
TestCase for salt.states.boto_vpc state.module
|
||||
'''
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_present_when_vpc_does_not_exist(self):
|
||||
'''
|
||||
Tests present on a VPC that does not exist.
|
||||
@ -142,14 +143,14 @@ class BotoVpcTestCase(BotoVpcStateTestCaseBase, BotoVpcTestCaseMixin):
|
||||
self.assertTrue(vpc_present_result['result'])
|
||||
self.assertEqual(vpc_present_result['changes']['new']['vpc']['state'], 'available')
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_present_when_vpc_exists(self):
|
||||
vpc = self._create_vpc(name='test')
|
||||
vpc_present_result = self.salt_states['boto_vpc.present']('test', cidr_block)
|
||||
self.assertTrue(vpc_present_result['result'])
|
||||
self.assertEqual(vpc_present_result['changes'], {})
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_present_with_failure(self):
|
||||
with patch('moto.ec2.models.VPCBackend.create_vpc', side_effect=BotoServerError(400, 'Mocked error')):
|
||||
@ -157,7 +158,7 @@ class BotoVpcTestCase(BotoVpcStateTestCaseBase, BotoVpcTestCaseMixin):
|
||||
self.assertFalse(vpc_present_result['result'])
|
||||
self.assertTrue('Mocked error' in vpc_present_result['comment'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_absent_when_vpc_does_not_exist(self):
|
||||
'''
|
||||
Tests absent on a VPC that does not exist.
|
||||
@ -167,7 +168,7 @@ class BotoVpcTestCase(BotoVpcStateTestCaseBase, BotoVpcTestCaseMixin):
|
||||
self.assertTrue(vpc_absent_result['result'])
|
||||
self.assertEqual(vpc_absent_result['changes'], {})
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_absent_when_vpc_exists(self):
|
||||
vpc = self._create_vpc(name='test')
|
||||
with patch.dict(salt.utils.boto.__salt__, self.funcs):
|
||||
@ -175,7 +176,7 @@ class BotoVpcTestCase(BotoVpcStateTestCaseBase, BotoVpcTestCaseMixin):
|
||||
self.assertTrue(vpc_absent_result['result'])
|
||||
self.assertEqual(vpc_absent_result['changes']['new']['vpc'], None)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_absent_with_failure(self):
|
||||
vpc = self._create_vpc(name='test')
|
||||
@ -195,7 +196,7 @@ class BotoVpcResourceTestCaseMixin(BotoVpcTestCaseMixin):
|
||||
_create = getattr(self, '_create_' + self.resource_type)
|
||||
_create(vpc_id=vpc_id, name=name, **self.extra_kwargs)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_present_when_resource_does_not_exist(self):
|
||||
'''
|
||||
Tests present on a resource that does not exist.
|
||||
@ -210,7 +211,7 @@ class BotoVpcResourceTestCaseMixin(BotoVpcTestCaseMixin):
|
||||
exists = self.funcs['boto_vpc.resource_exists'](self.resource_type, 'test').get('exists')
|
||||
self.assertTrue(exists)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_present_when_resource_exists(self):
|
||||
vpc = self._create_vpc(name='test')
|
||||
resource = self._create_resource(vpc_id=vpc.id, name='test')
|
||||
@ -220,7 +221,7 @@ class BotoVpcResourceTestCaseMixin(BotoVpcTestCaseMixin):
|
||||
self.assertTrue(resource_present_result['result'])
|
||||
self.assertEqual(resource_present_result['changes'], {})
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_present_with_failure(self):
|
||||
vpc = self._create_vpc(name='test')
|
||||
@ -231,7 +232,7 @@ class BotoVpcResourceTestCaseMixin(BotoVpcTestCaseMixin):
|
||||
self.assertFalse(resource_present_result['result'])
|
||||
self.assertTrue('Mocked error' in resource_present_result['comment'])
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_absent_when_resource_does_not_exist(self):
|
||||
'''
|
||||
Tests absent on a resource that does not exist.
|
||||
@ -241,7 +242,7 @@ class BotoVpcResourceTestCaseMixin(BotoVpcTestCaseMixin):
|
||||
self.assertTrue(resource_absent_result['result'])
|
||||
self.assertEqual(resource_absent_result['changes'], {})
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_absent_when_resource_exists(self):
|
||||
vpc = self._create_vpc(name='test')
|
||||
self._create_resource(vpc_id=vpc.id, name='test')
|
||||
@ -253,7 +254,7 @@ class BotoVpcResourceTestCaseMixin(BotoVpcTestCaseMixin):
|
||||
exists = self.funcs['boto_vpc.resource_exists'](self.resource_type, 'test').get('exists')
|
||||
self.assertFalse(exists)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
|
||||
def test_absent_with_failure(self):
|
||||
vpc = self._create_vpc(name='test')
|
||||
@ -291,6 +292,9 @@ class BotoVpcInternetGatewayTestCase(BotoVpcStateTestCaseBase, BotoVpcResourceTe
|
||||
|
||||
|
||||
@skipIf(NO_MOCK, NO_MOCK_REASON)
|
||||
@skipIf(six.PY3, 'Disabled for Python 3 due to upstream bugs: '
|
||||
'https://github.com/spulec/moto/issues/548 and '
|
||||
'https://github.com/gabrielfalcao/HTTPretty/issues/325')
|
||||
@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
|
||||
@skipIf(HAS_MOTO is False, 'The moto module must be installed.')
|
||||
@skipIf(_has_required_boto() is False, 'The boto module must be greater than'
|
||||
@ -301,7 +305,7 @@ class BotoVpcRouteTableTestCase(BotoVpcStateTestCaseBase, BotoVpcResourceTestCas
|
||||
backend_create = 'RouteTableBackend.create_route_table'
|
||||
backend_delete = 'RouteTableBackend.delete_route_table'
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_present_with_subnets(self):
|
||||
vpc = self._create_vpc(name='test')
|
||||
subnet1 = self._create_subnet(vpc_id=vpc.id, name='test1')
|
||||
@ -326,7 +330,7 @@ class BotoVpcRouteTableTestCase(BotoVpcStateTestCaseBase, BotoVpcResourceTestCas
|
||||
new_subnets = changes['new']['subnets_associations']
|
||||
self.assertEqual(new_subnets[0]['subnet_id'], subnet2.id)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_present_with_routes(self):
|
||||
vpc = self._create_vpc(name='test')
|
||||
igw = self._create_internet_gateway(name='test', vpc_id=vpc.id)
|
||||
|
@ -40,6 +40,11 @@ if sys.version_info[:3] > (2, 7, 8):
|
||||
else:
|
||||
SSL_VALIDATION = False
|
||||
|
||||
if hasattr(ssl, '_create_unverified_context'):
|
||||
ssl_context = 'ssl._create_unverified_context'
|
||||
else:
|
||||
ssl_context = 'ssl._create_stdlib_context'
|
||||
|
||||
# Get Logging Started
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -337,14 +342,14 @@ class PrivateGetServiceInstanceTestCase(TestCase):
|
||||
@skipIf(not SSL_VALIDATION, 'SSL validation is not enabled')
|
||||
def test_second_attempt_successful_connection(self):
|
||||
with patch('ssl.SSLContext', MagicMock()), \
|
||||
patch('ssl._create_unverified_context', MagicMock()):
|
||||
patch(ssl_context, MagicMock()):
|
||||
exc = vim.fault.HostConnectFault()
|
||||
exc.msg = '[SSL: CERTIFICATE_VERIFY_FAILED]'
|
||||
mock_sc = MagicMock(side_effect=[exc, None])
|
||||
mock_ssl = MagicMock()
|
||||
|
||||
with patch('salt.utils.vmware.SmartConnect', mock_sc):
|
||||
with patch('ssl._create_unverified_context',
|
||||
with patch(ssl_context,
|
||||
mock_ssl):
|
||||
|
||||
salt.utils.vmware._get_service_instance(
|
||||
@ -378,7 +383,7 @@ class PrivateGetServiceInstanceTestCase(TestCase):
|
||||
@skipIf(not SSL_VALIDATION, 'SSL validation is not enabled')
|
||||
def test_third_attempt_successful_connection(self):
|
||||
with patch('ssl.SSLContext', MagicMock()), \
|
||||
patch('ssl._create_unverified_context', MagicMock()):
|
||||
patch(ssl_context, MagicMock()):
|
||||
exc = vim.fault.HostConnectFault()
|
||||
exc.msg = '[SSL: CERTIFICATE_VERIFY_FAILED]'
|
||||
exc2 = Exception('certificate verify failed')
|
||||
@ -387,9 +392,7 @@ class PrivateGetServiceInstanceTestCase(TestCase):
|
||||
mock_ssl_context = MagicMock()
|
||||
|
||||
with patch('salt.utils.vmware.SmartConnect', mock_sc):
|
||||
with patch('ssl._create_unverified_context',
|
||||
mock_ssl_unverif):
|
||||
|
||||
with patch(ssl_context, mock_ssl_unverif):
|
||||
with patch('ssl.SSLContext', mock_ssl_context):
|
||||
|
||||
salt.utils.vmware._get_service_instance(
|
||||
@ -473,7 +476,7 @@ class PrivateGetServiceInstanceTestCase(TestCase):
|
||||
@skipIf(not SSL_VALIDATION, 'SSL validation is not enabled')
|
||||
def test_second_attempt_unsuccsessful_connection_default_error(self):
|
||||
with patch('ssl.SSLContext', MagicMock()), \
|
||||
patch('ssl._create_unverified_context', MagicMock()):
|
||||
patch(ssl_context, MagicMock()):
|
||||
exc = vim.fault.HostConnectFault()
|
||||
exc.msg = '[SSL: CERTIFICATE_VERIFY_FAILED]'
|
||||
exc2 = Exception('Exception')
|
||||
@ -498,7 +501,7 @@ class PrivateGetServiceInstanceTestCase(TestCase):
|
||||
@skipIf(not SSL_VALIDATION, 'SSL validation is not enabled')
|
||||
def test_second_attempt_unsuccsessful_connection_vim_fault(self):
|
||||
with patch('ssl.SSLContext', MagicMock()), \
|
||||
patch('ssl._create_unverified_context', MagicMock()):
|
||||
patch(ssl_context, MagicMock()):
|
||||
exc = vim.fault.HostConnectFault()
|
||||
exc.msg = '[SSL: CERTIFICATE_VERIFY_FAILED]'
|
||||
exc2 = vim.fault.VimFault()
|
||||
@ -523,7 +526,7 @@ class PrivateGetServiceInstanceTestCase(TestCase):
|
||||
@skipIf(not SSL_VALIDATION, 'SSL validation is not enabled')
|
||||
def test_third_attempt_unsuccessful_connection_detault_error(self):
|
||||
with patch('ssl.SSLContext', MagicMock()), \
|
||||
patch('ssl._create_unverified_context', MagicMock()):
|
||||
patch(ssl_context, MagicMock()):
|
||||
exc = vim.fault.HostConnectFault()
|
||||
exc.msg = '[SSL: CERTIFICATE_VERIFY_FAILED]'
|
||||
exc2 = Exception('certificate verify failed')
|
||||
@ -548,7 +551,7 @@ class PrivateGetServiceInstanceTestCase(TestCase):
|
||||
@skipIf(not SSL_VALIDATION, 'SSL validation is not enabled')
|
||||
def test_third_attempt_unsuccessful_connection_vim_fault(self):
|
||||
with patch('ssl.SSLContext', MagicMock()), \
|
||||
patch('ssl._create_unverified_context', MagicMock()):
|
||||
patch(ssl_context, MagicMock()):
|
||||
exc = vim.fault.HostConnectFault()
|
||||
exc.msg = '[SSL: CERTIFICATE_VERIFY_FAILED]'
|
||||
exc2 = Exception('certificate verify failed')
|
||||
|
Loading…
Reference in New Issue
Block a user