Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
* upstream/develop: (24 commits)
  Remove deprecated rc_info function from version.py
  Document change in saltstack#42254
  Added release notes comment
  Syntax change
  Logical Domains support in virtual grain
  Add support for IDMS Linux
  win_pki: Don't fail on certs without DnsNames
  Fix tests saltstack#2
  zypper.list_pkgs: add all option for attr
  zypper.list_pkgs: move attr parameter to kwargs
  zypper.list_pkgs: add install_time_date_t as a supported attribute
  zypper_test: add test for list_pkgs and attr
  zypper_test: adapt existing unit tests to new code
  zypper_test: correct mock behavior
  zypper.list_pkgs: add documentation for attr param
  zypper.list_pkgs: add attr option
  Fixed test
  Fixed pylint
  Move parse_docstring from salt.utils to salt.utils.doc.py
  Added tests for salt.modules.vsphere.create_datacenter
  ...
  • Loading branch information
jojohans committed Jul 26, 2017
2 parents 38759a9 + ddc0286 commit 4e5fc1c
Show file tree
Hide file tree
Showing 14 changed files with 511 additions and 93 deletions.
4 changes: 2 additions & 2 deletions doc/topics/cloud/profitbricks.rst
Expand Up @@ -34,8 +34,8 @@ Configuration
#
username: user@domain.com
password: 123456
# datacenter is the UUID of a pre-existing virtual data center.
datacenter: 9e6709a0-6bf9-4bd6-8692-60349c70ce0e
# datacenter_id is the UUID of a pre-existing virtual data center.
datacenter_id: 9e6709a0-6bf9-4bd6-8692-60349c70ce0e
# Connect to public LAN ID 1.
public_lan: 1
ssh_public_key: /path/to/id_rsa.pub
Expand Down
24 changes: 24 additions & 0 deletions doc/topics/releases/oxygen.rst
Expand Up @@ -55,12 +55,29 @@ Salt Cloud and Newer PyWinRM Versions
Versions of ``pywinrm>=0.2.1`` are finally able to disable validation of self
signed certificates. :ref:`Here<new-pywinrm>` for more information.

Solaris Logical Domains In Virtual Grain
----------------------------------------

Support has been added to the ``virtual`` grain for detecting Solaris LDOMs
running on T-Series SPARC hardware. The ``virtual_subtype`` grain is
populated as a list of domain roles.


Deprecations
============

Configuration Option Deprecations
---------------------------------

- The ``requests_lib`` configuration option has been removed. Please use
``backend`` instead.

Profitbricks Cloud Updated Dependency
-------------------------------------

The minimum version of the `profitbrick` python package for the `profitbricks`
cloud driver has changed from 3.0.0 to 3.1.0.

Module Deprecations
-------------------

Expand Down Expand Up @@ -147,3 +164,10 @@ The ``salt.utils.cloud.py`` file had the following change:

- The ``fire_event`` function now requires a ``sock_dir`` argument. It was previously
optional.

Other Miscellaneous Deprecations
--------------------------------

The ``version.py`` file had the following changes:

- The ``rc_info`` function was removed. Please use ``pre_info`` instead.
13 changes: 10 additions & 3 deletions salt/cloud/clouds/profitbricks.py
Expand Up @@ -6,7 +6,7 @@
The ProfitBricks SaltStack cloud module allows a ProfitBricks server to
be automatically deployed and bootstraped with Salt.
:depends: profitbrick >= 3.0.0
:depends: profitbrick >= 3.1.0
The module requires ProfitBricks credentials to be supplied along with
an existing virtual datacenter UUID where the server resources will
Expand Down Expand Up @@ -115,7 +115,8 @@
from profitbricks.client import (
ProfitBricksService, Server,
NIC, Volume, FirewallRule,
Datacenter, LoadBalancer, LAN
Datacenter, LoadBalancer, LAN,
PBNotFoundError
)
HAS_PROFITBRICKS = True
except ImportError:
Expand Down Expand Up @@ -480,7 +481,13 @@ def list_nodes(conn=None, call=None):

ret = {}
datacenter_id = get_datacenter_id()
nodes = conn.list_servers(datacenter_id=datacenter_id)

try:
nodes = conn.list_servers(datacenter_id=datacenter_id)
except PBNotFoundError:
log.error('Failed to get nodes list from datacenter: {0}'.format(
datacenter_id))
raise

for item in nodes['items']:
node = {'id': item['id']}
Expand Down
50 changes: 38 additions & 12 deletions salt/grains/core.py
Expand Up @@ -541,8 +541,20 @@ def _virtual(osdata):
command = 'system_profiler'
args = ['SPDisplaysDataType']
elif osdata['kernel'] == 'SunOS':
command = 'prtdiag'
args = []
virtinfo = salt.utils.which('virtinfo')
if virtinfo:
try:
ret = __salt__['cmd.run_all']('{0} -a'.format(virtinfo))
except salt.exceptions.CommandExecutionError:
if salt.log.is_logging_configured():
failed_commands.add(virtinfo)
else:
if ret['stdout'].endswith('not supported'):
command = 'prtdiag'
else:
command = 'virtinfo'
else:
command = 'prtdiag'

cmd = salt.utils.which(command)

Expand Down Expand Up @@ -689,6 +701,9 @@ def _virtual(osdata):
elif 'joyent smartdc hvm' in model:
grains['virtual'] = 'kvm'
break
elif command == 'virtinfo':
grains['virtual'] = 'LDOM'
break
else:
if osdata['kernel'] not in skip_cmds:
log.debug(
Expand Down Expand Up @@ -828,17 +843,27 @@ def _virtual(osdata):
if osdata['manufacturer'] in ['QEMU', 'Red Hat']:
grains['virtual'] = 'kvm'
elif osdata['kernel'] == 'SunOS':
# Check if it's a "regular" zone. (i.e. Solaris 10/11 zone)
zonename = salt.utils.which('zonename')
if zonename:
zone = __salt__['cmd.run']('{0}'.format(zonename))
if zone != 'global':
if grains['virtual'] == 'LDOM':
roles = []
for role in ('control', 'io', 'root', 'service'):
subtype_cmd = '{0} -c current get -H -o value {1}-role'.format(cmd, role)
ret = __salt__['cmd.run_all']('{0}'.format(subtype_cmd))
if ret['stdout'] == 'true':
roles.append(role)
if roles:
grains['virtual_subtype'] = roles
else:
# Check if it's a "regular" zone. (i.e. Solaris 10/11 zone)
zonename = salt.utils.which('zonename')
if zonename:
zone = __salt__['cmd.run']('{0}'.format(zonename))
if zone != 'global':
grains['virtual'] = 'zone'
if salt.utils.is_smartos_zone():
grains.update(_smartos_zone_data())
# Check if it's a branded zone (i.e. Solaris 8/9 zone)
if isdir('/.SUNWnative'):
grains['virtual'] = 'zone'
if salt.utils.is_smartos_zone():
grains.update(_smartos_zone_data())
# Check if it's a branded zone (i.e. Solaris 8/9 zone)
if isdir('/.SUNWnative'):
grains['virtual'] = 'zone'
elif osdata['kernel'] == 'NetBSD':
if sysctl:
if 'QEMU Virtual CPU' in __salt__['cmd.run'](
Expand Down Expand Up @@ -1188,6 +1213,7 @@ def id_():
'NILinuxRT-XFCE': 'NILinuxRT',
'KDE neon': 'Debian',
'Void': 'Void',
'IDMS': 'Debian',
}


Expand Down
62 changes: 62 additions & 0 deletions salt/modules/vsphere.py
Expand Up @@ -3591,6 +3591,68 @@ def vsan_enable(host, username, password, protocol=None, port=None, host_names=N
return ret


@depends(HAS_PYVMOMI)
@supports_proxies('esxdatacenter')
@gets_service_instance_via_proxy
def list_datacenters_via_proxy(datacenter_names=None, service_instance=None):
'''
Returns a list of dict representations of VMware datacenters.
Connection is done via the proxy details.
Supported proxies: esxdatacenter
datacenter_names
List of datacenter names.
Default is None.
service_instance
Service instance (vim.ServiceInstance) of the vCenter.
Default is None.
.. code-block:: bash
salt '*' vsphere.list_datacenters_via_proxy
salt '*' vsphere.list_datacenters_via_proxy dc1
salt '*' vsphere.list_datacenters_via_proxy dc1,dc2
salt '*' vsphere.list_datacenters_via_proxy datacenter_names=[dc1, dc2]
'''
if not datacenter_names:
dc_refs = salt.utils.vmware.get_datacenters(service_instance,
get_all_datacenters=True)
else:
dc_refs = salt.utils.vmware.get_datacenters(service_instance,
datacenter_names)

return [{'name': salt.utils.vmware.get_managed_object_name(dc_ref)}
for dc_ref in dc_refs]


@depends(HAS_PYVMOMI)
@supports_proxies('esxdatacenter')
@gets_service_instance_via_proxy
def create_datacenter(datacenter_name, service_instance=None):
'''
Creates a datacenter.
Supported proxies: esxdatacenter
datacenter_name
The datacenter name
service_instance
Service instance (vim.ServiceInstance) of the vCenter.
Default is None.
.. code-block:: bash
salt '*' vsphere.create_datacenter dc1
'''
salt.utils.vmware.create_datacenter(service_instance, datacenter_name)
return {'create_datacenter': True}


def _check_hosts(service_instance, host, host_names):
'''
Helper function that checks to see if the host provided is a vCenter Server or
Expand Down
2 changes: 1 addition & 1 deletion salt/modules/win_pki.py
Expand Up @@ -155,7 +155,7 @@ def get_certs(context=_DEFAULT_CONTEXT, store=_DEFAULT_STORE):
if key not in blacklist_keys:
cert_info[key.lower()] = item[key]

cert_info['dnsnames'] = [name['Unicode'] for name in item['DnsNameList']]
cert_info['dnsnames'] = [name.get('Unicode') for name in item.get('DnsNameList', {})]
ret[item['Thumbprint']] = cert_info
return ret

Expand Down

0 comments on commit 4e5fc1c

Please sign in to comment.