mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge remote-tracking branch 'upstream/2015.5' into merge-forward-2015.8
Conflicts: README.rst salt/modules/yumpkg.py
This commit is contained in:
commit
d86e014a39
7 changed files with 170 additions and 90 deletions
125
README.rst
125
README.rst
|
@ -2,67 +2,108 @@
|
|||
What is SaltStack?
|
||||
==================
|
||||
|
||||
Salt is a new approach to infrastructure management. Easy enough to get
|
||||
running in minutes, scalable enough to manage tens of thousands of servers,
|
||||
and fast enough to communicate with them in *seconds*.
|
||||
SaltStack makes software for complex systems management at scale.
|
||||
SaltStack is the company that created and maintains the Salt Open
|
||||
project and develops and sells SaltStack Enterprise software, services
|
||||
and support. Easy enough to get running in minutes, scalable enough to
|
||||
manage tens of thousands of servers, and fast enough to communicate with
|
||||
them in *seconds*.
|
||||
|
||||
Salt delivers a dynamic communication bus for infrastructures that can be used
|
||||
for orchestration, remote execution, configuration management and much more.
|
||||
Salt is a new approach to infrastructure management built on a dynamic
|
||||
communication bus. Salt can be used for data-driven orchestration,
|
||||
remote execution for any infrastructure, configuration management for
|
||||
any app stack, and much more.
|
||||
|
||||
Documentation
|
||||
=============
|
||||
Download Salt Open
|
||||
==================
|
||||
|
||||
Salt Open is tested and packaged to run on CentOS, Debian, RHEL, Ubuntu,
|
||||
Windows. Download Salt Open and get started now.
|
||||
|
||||
`<https://repo.saltstack.com/>`_
|
||||
|
||||
`Installation Instructions <https://docs.saltstack.com/en/latest/topics/installation/index.html>`_
|
||||
|
||||
SaltStack Documentation
|
||||
=======================
|
||||
|
||||
Installation instructions, getting started guides, and in-depth API
|
||||
documentation.
|
||||
|
||||
http://docs.saltstack.com
|
||||
`<https://docs.saltstack.com/en/getstarted/>`_
|
||||
|
||||
IRC Chat
|
||||
========
|
||||
`<https://docs.saltstack.com/en/latest/>`_
|
||||
|
||||
Join the vibrant, helpful and positive SaltStack chat room in Freenode at
|
||||
#salt. There is no need to introduce yourself, or ask permission to join in,
|
||||
just help and be helped! Make sure to wait for an answer, sometimes it may take
|
||||
a few moments for someone to reply.
|
||||
Get SaltStack Support and Help
|
||||
==============================
|
||||
|
||||
http://webchat.freenode.net/?channels=salt&uio=Mj10cnVlJjk9dHJ1ZSYxMD10cnVl83
|
||||
**IRC Chat** - Join the vibrant, helpful and positive SaltStack chat room in
|
||||
Freenode at #salt. There is no need to introduce yourself, or ask permission to
|
||||
join in, just help and be helped! Make sure to wait for an answer, sometimes it
|
||||
may take a few moments for someone to reply.
|
||||
|
||||
Salt Air
|
||||
========
|
||||
`<http://webchat.freenode.net/?channels=salt&uio=Mj10cnVlJjk9dHJ1ZSYxMD10cnVl83>`_
|
||||
|
||||
The SaltStack YouTube channel is filled with Salt videos and presentations.
|
||||
Watch the latest Salt Air episodes for updates from Thomas on development,
|
||||
catch tutorials, and stay on the cutting edge of Salt.
|
||||
**Mailing List** - The SaltStack community users mailing list is hosted by
|
||||
Google groups. Anyone can post to ask questions about SaltStack products and
|
||||
anyone can help answer. Join the conversation!
|
||||
|
||||
http://www.youtube.com/user/saltstack
|
||||
|
||||
Mailing List
|
||||
============
|
||||
|
||||
The SaltStack community users mailing list is hosted by Google groups. Anyone
|
||||
can post to ask questions about SaltStack products and anyone can help answer.
|
||||
Join the conversation!
|
||||
|
||||
https://groups.google.com/forum/#!forum/salt-users
|
||||
`<https://groups.google.com/forum/#!forum/salt-users>`_
|
||||
|
||||
You may subscribe to the list without a Google account by emailing
|
||||
salt-users+subscribe@googlegroups.com and you may post to the list by emailing
|
||||
salt-users@googlegroups.com
|
||||
|
||||
**Reporting Issues** - To report an issue with Salt, please follow the
|
||||
guidelines for filing bug reports:
|
||||
`<https://docs.saltstack.com/en/develop/topics/development/reporting_bugs.html>`_
|
||||
|
||||
**SaltStack Support** - If you need dedicated, prioritized support, please
|
||||
consider a SaltStack Support package that fits your needs:
|
||||
`<http://www.saltstack.com/support>`_
|
||||
|
||||
Engage SaltStack
|
||||
================
|
||||
|
||||
`SaltConf`_, **User Groups and Meetups** - SaltStack has a vibrant and `global
|
||||
community`_ of customers, users, developers and enthusiasts. Connect with other
|
||||
Salted folks in your area of the world, or join `SaltConf16`_, the SaltStack
|
||||
annual user conference, April 19-21 in Salt Lake City. Please let us know if
|
||||
you would like to start a user group or if we should add your existing
|
||||
SaltStack user group to this list by emailing: info@saltstack.com
|
||||
|
||||
**SaltStack Training** - Get access to proprietary `SaltStack education
|
||||
offerings`_ through instructor-led training offered on-site, virtually or at
|
||||
SaltStack headquarters in Salt Lake City. SaltStack Enterprise training helps
|
||||
increase the value and effectiveness of SaltStack software for any customer and
|
||||
is a prerequisite for coveted `SaltStack Certified Engineer (SSCE)`_ status.
|
||||
SaltStack training is also available through several `SaltStack professional
|
||||
services`_ offerings.
|
||||
|
||||
**Follow SaltStack on -**
|
||||
|
||||
* YouTube - `<http://www.youtube.com/saltstack>`_
|
||||
* Twitter - `<http://www.twitter.com/saltstack>`_
|
||||
* Facebook - `<https://www.facebook.com/SaltStack/>`_
|
||||
* LinkedIn - `<https://www.linkedin.com/company/salt-stack-inc>`_
|
||||
* LinkedIn Group - `<https://www.linkedin.com/groups/4877160>`_
|
||||
* Google+ - `<https://plus.google.com/b/112856352920437801867/+SaltStackInc/posts>`_
|
||||
|
||||
.. _SaltConf: http://www.youtube.com/user/saltstack
|
||||
.. _global community: http://www.meetup.com/pro/saltstack/
|
||||
.. _SaltConf16: http://saltconf.com/
|
||||
.. _SaltStack education offerings: http://saltstack.com/training/
|
||||
.. _SaltStack Certified Engineer (SSCE): http://saltstack.com/certification/
|
||||
.. _SaltStack professional services: http://saltstack.com/services/
|
||||
|
||||
Developing Salt
|
||||
===============
|
||||
|
||||
The Salt development team is welcoming, positive, and dedicated to helping
|
||||
people get new code and fixes into SaltStack projects. Log into GitHub and get
|
||||
started with one of the largest developer communities in the world. The following
|
||||
links should get you started:
|
||||
The Salt development team is welcoming, positive, and dedicated to
|
||||
helping people get new code and fixes into SaltStack projects. Log into
|
||||
GitHub and get started with one of the largest developer communities in
|
||||
the world. The following links should get you started:
|
||||
|
||||
* https://github.com/saltstack
|
||||
* http://docs.saltstack.com/en/latest/topics/development/index.html
|
||||
* `<https://github.com/saltstack>`_
|
||||
* `<https://docs.saltstack.com/en/latest/topics/development/index.html>`_
|
||||
|
||||
Reporting Issues
|
||||
================
|
||||
|
||||
To report an issue with Salt, please follow the guidelines for filing bug reports:
|
||||
|
||||
* http://docs.saltstack.com/en/latest/topics/development/reporting_bugs.html
|
||||
|
|
|
@ -908,7 +908,7 @@ def id_():
|
|||
'''
|
||||
return {'id': __opts__.get('id', '')}
|
||||
|
||||
_REPLACE_LINUX_RE = re.compile(r'linux', re.IGNORECASE)
|
||||
_REPLACE_LINUX_RE = re.compile(r'\Wlinux', re.IGNORECASE)
|
||||
|
||||
# This maps (at most) the first ten characters (no spaces, lowercased) of
|
||||
# 'osfullname' to the 'os' grain that Salt traditionally uses.
|
||||
|
|
|
@ -195,7 +195,7 @@ def create(name, availability_zones, listeners=None, subnets=None,
|
|||
return False
|
||||
except boto.exception.BotoServerError as error:
|
||||
log.debug(error)
|
||||
msg = 'Failed to create ELB {0}: {1}'.format(name, error)
|
||||
msg = 'Failed to create ELB {0}: {1}: {2}'.format(name, error.error_code, error.message)
|
||||
log.error(msg)
|
||||
return False
|
||||
|
||||
|
|
|
@ -833,9 +833,12 @@ def _parse_settings_bond_0(opts, iface, bond_def):
|
|||
if 'arp_ip_target' in opts:
|
||||
if isinstance(opts['arp_ip_target'], list):
|
||||
if 1 <= len(opts['arp_ip_target']) <= 16:
|
||||
bond.update({'arp_ip_target': []})
|
||||
bond.update({'arp_ip_target': ''})
|
||||
for ip in opts['arp_ip_target']: # pylint: disable=C0103
|
||||
bond['arp_ip_target'].append(ip)
|
||||
if len(bond['arp_ip_target']) > 0:
|
||||
bond['arp_ip_target'] = bond['arp_ip_target'] + ',' + ip
|
||||
else:
|
||||
bond['arp_ip_target'] = ip
|
||||
else:
|
||||
_raise_error_iface(iface, 'arp_ip_target', valid)
|
||||
else:
|
||||
|
@ -906,9 +909,12 @@ def _parse_settings_bond_2(opts, iface, bond_def):
|
|||
if 'arp_ip_target' in opts:
|
||||
if isinstance(opts['arp_ip_target'], list):
|
||||
if 1 <= len(opts['arp_ip_target']) <= 16:
|
||||
bond.update({'arp_ip_target': []})
|
||||
bond.update({'arp_ip_target': ''})
|
||||
for ip in opts['arp_ip_target']: # pylint: disable=C0103
|
||||
bond['arp_ip_target'].append(ip)
|
||||
if len(bond['arp_ip_target']) > 0:
|
||||
bond['arp_ip_target'] = bond['arp_ip_target'] + ',' + ip
|
||||
else:
|
||||
bond['arp_ip_target'] = ip
|
||||
else:
|
||||
_raise_error_iface(iface, 'arp_ip_target', valid)
|
||||
else:
|
||||
|
@ -1903,8 +1909,9 @@ def build_network_settings(**settings):
|
|||
|
||||
# Only write the hostname if it has changed
|
||||
if not opts['hostname'] == current_network_settings['hostname']:
|
||||
# TODO replace wiht a call to network.mod_hostname instead
|
||||
_write_file_network(hostname, _DEB_HOSTNAME_FILE)
|
||||
if not ('test' in settings and settings['test']):
|
||||
# TODO replace wiht a call to network.mod_hostname instead
|
||||
_write_file_network(hostname, _DEB_HOSTNAME_FILE)
|
||||
|
||||
new_domain = False
|
||||
if len(sline) > 1:
|
||||
|
@ -1942,7 +1949,8 @@ def build_network_settings(**settings):
|
|||
new_resolv = ''.join(new_contents)
|
||||
|
||||
# Write /etc/resolv.conf
|
||||
_write_file_network(new_resolv, _DEB_RESOLV_FILE)
|
||||
if not ('test' in settings and settings['test']):
|
||||
_write_file_network(new_resolv, _DEB_RESOLV_FILE)
|
||||
|
||||
# used for returning the results back
|
||||
try:
|
||||
|
|
|
@ -49,8 +49,8 @@ def connect(image):
|
|||
'{0} does not exist'.format(image))
|
||||
return ''
|
||||
|
||||
if salt.utils.which('cfdisk'):
|
||||
fdisk = 'cfdisk -P t'
|
||||
if salt.utils.which('sfdisk'):
|
||||
fdisk = 'sfdisk -d'
|
||||
else:
|
||||
fdisk = 'fdisk -l'
|
||||
__salt__['cmd.run']('modprobe nbd max_part=63')
|
||||
|
|
|
@ -275,9 +275,12 @@ def _parse_settings_bond_0(opts, iface, bond_def):
|
|||
if 'arp_ip_target' in opts:
|
||||
if isinstance(opts['arp_ip_target'], list):
|
||||
if 1 <= len(opts['arp_ip_target']) <= 16:
|
||||
bond.update({'arp_ip_target': []})
|
||||
bond.update({'arp_ip_target': ''})
|
||||
for ip in opts['arp_ip_target']: # pylint: disable=C0103
|
||||
bond['arp_ip_target'].append(ip)
|
||||
if len(bond['arp_ip_target']) > 0:
|
||||
bond['arp_ip_target'] = bond['arp_ip_target'] + ',' + ip
|
||||
else:
|
||||
bond['arp_ip_target'] = ip
|
||||
else:
|
||||
_raise_error_iface(iface, 'arp_ip_target', valid)
|
||||
else:
|
||||
|
@ -348,9 +351,12 @@ def _parse_settings_bond_2(opts, iface, bond_def):
|
|||
if 'arp_ip_target' in opts:
|
||||
if isinstance(opts['arp_ip_target'], list):
|
||||
if 1 <= len(opts['arp_ip_target']) <= 16:
|
||||
bond.update({'arp_ip_target': []})
|
||||
bond.update({'arp_ip_target': ''})
|
||||
for ip in opts['arp_ip_target']: # pylint: disable=C0103
|
||||
bond['arp_ip_target'].append(ip)
|
||||
if len(bond['arp_ip_target']) > 0:
|
||||
bond['arp_ip_target'] = bond['arp_ip_target'] + ',' + ip
|
||||
else:
|
||||
bond['arp_ip_target'] = ip
|
||||
else:
|
||||
_raise_error_iface(iface, 'arp_ip_target', valid)
|
||||
else:
|
||||
|
|
|
@ -59,6 +59,8 @@ from salt.exceptions import (
|
|||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
__HOLD_PATTERN = r'\w+(?:[.-][^-]+)*'
|
||||
|
||||
# Define the module's virtual name
|
||||
__virtualname__ = 'pkg'
|
||||
|
||||
|
@ -97,6 +99,36 @@ def _strip_headers(output, *args):
|
|||
return ret
|
||||
|
||||
|
||||
def _get_hold(line, pattern=__HOLD_PATTERN, full=True):
|
||||
'''
|
||||
Resolve a package name from a line containing the hold expression. If the
|
||||
regex is not matched, None is returned.
|
||||
|
||||
yum ==> 2:vim-enhanced-7.4.629-5.el6.*
|
||||
dnf ==> vim-enhanced-2:7.4.827-1.fc22.*
|
||||
'''
|
||||
if full:
|
||||
if _yum() == 'dnf':
|
||||
lock_re = r'({0}-\S+)'.format(pattern)
|
||||
else:
|
||||
lock_re = r'(\d+:{0}-\S+)'.format(pattern)
|
||||
else:
|
||||
if _yum() == 'dnf':
|
||||
lock_re = r'({0}-\S+)'.format(pattern)
|
||||
else:
|
||||
lock_re = r'\d+:({0}-\S+)'.format(pattern)
|
||||
|
||||
match = re.search(lock_re, line)
|
||||
if match:
|
||||
if not full:
|
||||
woarch = match.group(1).rsplit('.', 1)[0]
|
||||
worel = woarch.rsplit('-', 1)[0]
|
||||
return worel.rsplit('-', 1)[0]
|
||||
else:
|
||||
return match.group(1)
|
||||
return None
|
||||
|
||||
|
||||
def _yum():
|
||||
'''
|
||||
return yum or dnf depending on version
|
||||
|
@ -1631,7 +1663,11 @@ def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W06
|
|||
else:
|
||||
targets.append(name)
|
||||
|
||||
current_locks = list_holds(full=False)
|
||||
# Yum's versionlock plugin doesn't support passing just the package name
|
||||
# when removing a lock, so we need to get the full list and then use
|
||||
# fnmatch below to find the match.
|
||||
current_locks = list_holds(full=_yum() == 'yum')
|
||||
|
||||
ret = {}
|
||||
for target in targets:
|
||||
if isinstance(target, dict):
|
||||
|
@ -1642,9 +1678,22 @@ def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W06
|
|||
'result': False,
|
||||
'comment': ''}
|
||||
|
||||
search_locks = [x for x in current_locks if target in x]
|
||||
if _yum() == 'dnf':
|
||||
search_locks = [x for x in current_locks if x == target]
|
||||
else:
|
||||
# To accommodate yum versionlock's lack of support for removing
|
||||
# locks using just the package name, we have to use fnmatch to do
|
||||
# glob matching on the target name, and then for each matching
|
||||
# expression double-check that the package name (obtained via
|
||||
# _get_hold()) matches the targeted package.
|
||||
search_locks = [
|
||||
x for x in current_locks
|
||||
if fnmatch.fnmatch(x, '*{0}*'.format(target))
|
||||
and target == _get_hold(x, full=False)
|
||||
]
|
||||
|
||||
if search_locks:
|
||||
if 'test' in __opts__ and __opts__['test']:
|
||||
if __opts__['test']:
|
||||
ret[target].update(result=None)
|
||||
ret[target]['comment'] = ('Package {0} is set to be unheld.'
|
||||
.format(target))
|
||||
|
@ -1668,7 +1717,7 @@ def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W06
|
|||
return ret
|
||||
|
||||
|
||||
def list_holds(pattern=r'\w+(?:[.-][^-]+)*', full=True):
|
||||
def list_holds(pattern=__HOLD_PATTERN, full=True):
|
||||
r'''
|
||||
.. versionchanged:: Boron,2015.8.4,2015.5.10
|
||||
Function renamed from ``pkg.get_locked_pkgs`` to ``pkg.list_holds``.
|
||||
|
@ -1699,37 +1748,13 @@ def list_holds(pattern=r'\w+(?:[.-][^-]+)*', full=True):
|
|||
'''
|
||||
_check_versionlock()
|
||||
|
||||
# yum ==> 2:vim-enhanced-7.4.629-5.el6.*
|
||||
# dnf ==> vim-enhanced-2:7.4.827-1.fc22.*
|
||||
|
||||
yum_cmd = _yum()
|
||||
if full:
|
||||
if yum_cmd == 'dnf':
|
||||
lock_re = r'({0}-\S+)'.format(pattern)
|
||||
else:
|
||||
lock_re = r'(\d+:{0}-\S+)'.format(pattern)
|
||||
else:
|
||||
if yum_cmd == 'dnf':
|
||||
lock_re = r'({0}-\S+)'.format(pattern)
|
||||
else:
|
||||
lock_re = r'\d+:({0}-\S+)'.format(pattern)
|
||||
|
||||
pat = re.compile(lock_re)
|
||||
|
||||
out = __salt__['cmd.run']([yum_cmd, 'versionlock', 'list'],
|
||||
out = __salt__['cmd.run']([_yum(), 'versionlock', 'list'],
|
||||
python_shell=False)
|
||||
ret = []
|
||||
for item in out.splitlines():
|
||||
match = pat.search(item)
|
||||
if match:
|
||||
if not full:
|
||||
woarch = match.group(1).rsplit('.', 1)[0]
|
||||
worel = woarch.rsplit('-', 1)[0]
|
||||
wover = worel.rsplit('-', 1)[0]
|
||||
target = wover
|
||||
else:
|
||||
target = match.group(1)
|
||||
ret.append(target)
|
||||
for line in out.splitlines():
|
||||
match = _get_hold(line, pattern=pattern, full=full)
|
||||
if match is not None:
|
||||
ret.append(match)
|
||||
return ret
|
||||
|
||||
get_locked_packages = salt.utils.alias_function(list_holds, 'get_locked_packages')
|
||||
|
|
Loading…
Add table
Reference in a new issue