Merge branch 'develop' into salt-cloud-libvirt-tweaks

This commit is contained in:
Ric Klaren 2017-06-02 14:57:15 +02:00 committed by GitHub
commit b08ddbb6d9
3 changed files with 30 additions and 4 deletions

View File

@ -3182,7 +3182,7 @@ def is_profile_configured(opts, provider, profile_name, vm_=None):
alias, driver = provider.split(':') alias, driver = provider.split(':')
# Most drivers need an image to be specified, but some do not. # Most drivers need an image to be specified, but some do not.
non_image_drivers = ['nova', 'virtualbox', 'libvirt'] non_image_drivers = ['nova', 'virtualbox', 'libvirt', 'softlayer']
# Most drivers need a size, but some do not. # Most drivers need a size, but some do not.
non_size_drivers = ['opennebula', 'parallels', 'proxmox', 'scaleway', non_size_drivers = ['opennebula', 'parallels', 'proxmox', 'scaleway',

View File

@ -22,7 +22,6 @@ import time
# Import salt libs # Import salt libs
import salt.utils import salt.utils
import salt.syspaths
from salt.exceptions import SaltInvocationError from salt.exceptions import SaltInvocationError
from salt.utils.versions import LooseVersion as _LooseVersion from salt.utils.versions import LooseVersion as _LooseVersion
@ -133,7 +132,7 @@ def _get_user_gnupghome(user):
Return default GnuPG home directory path for a user Return default GnuPG home directory path for a user
''' '''
if user == 'salt': if user == 'salt':
gnupghome = os.path.join(salt.syspaths.CONFIG_DIR, 'gpgkeys') gnupghome = os.path.join(__salt__['config.get']('config_dir'), 'gpgkeys')
else: else:
gnupghome = os.path.join(_get_user_info(user)['home'], '.gnupg') gnupghome = os.path.join(_get_user_info(user)['home'], '.gnupg')
@ -929,7 +928,7 @@ def trust_key(keyid=None,
_user = user _user = user
if user == 'salt': if user == 'salt':
homeDir = os.path.join(salt.syspaths.CONFIG_DIR, 'gpgkeys') homeDir = os.path.join(__salt__['config.get']('config_dir'), 'gpgkeys')
cmd.extend([' --homedir', homeDir]) cmd.extend([' --homedir', homeDir])
_user = 'root' _user = 'root'
res = __salt__['cmd.run_all'](cmd, res = __salt__['cmd.run_all'](cmd,

View File

@ -0,0 +1,27 @@
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from tests.support.unit import TestCase
from tests.support.unit import skipIf
from salt.beacons.network_settings import ATTRS
try:
from pyroute2 import IPDB
HAS_PYROUTE2 = True
except ImportError:
HAS_PYROUTE2 = False
@skipIf(not HAS_PYROUTE2, 'no pyroute2 installed, skipping')
class Pyroute2TestCase(TestCase):
def test_interface_dict_fields(self):
with IPDB() as ipdb:
for attr in ATTRS:
# ipdb.interfaces is a dict-like object, that
# contains interface definitions. Interfaces can
# be referenced both with indices and names.
#
# ipdb.interfaces[1] is an interface with index 1,
# that is the loopback interface.
self.assertIn(attr, ipdb.interfaces[1])