Changes to the proxy minion, add release notes, remove REST server (move to separate repo)

This commit is contained in:
C. R. Oldham 2014-02-04 12:19:13 -07:00
parent 8d1e170926
commit 83672380d6
7 changed files with 103 additions and 243 deletions

View File

@ -1,234 +1,18 @@
===============================================
Salt 2014.1.0 Release Notes - Codename Hydrogen
===============================================
:release: 2014-02-03
The 2014.1.0 release of Salt is a major release which not only increases
stability but also brings new capabilities in virtualization, cloud
integration, and more. This release brings a great focus on the expansion of
testing making roughly double the coverage in the Salt tests, and comes with
many new features.
2014.1.0 is the first release to follow the new date-based release naming
system.
Major Features
==============
Salt Cloud Merged into Salt
---------------------------
Salt Cloud is a tool for provisioning salted minions across various cloud
providers. Prior to this release, Salt Cloud was a separate project but this
marks its full integration with the Salt distribution. A Getting Started guide
and additional documentation for Salt Cloud can be found :doc:`here
</topics/cloud/index>`:
Google Compute Engine
---------------------
Alongside Salt Cloud comes new support for the Google Compute Engine. Salt Stack
can now deploy and control GCE virtual machines and the application stacks that
they run.
For more information on Salt Stack and GCE, please see `this blog post`_.
Documentation for Salt and GCE can be found :doc:`here </topics/cloud/gce>`.
.. _this blog post: http://googlecloudplatform.blogspot.com/2013/12/saltstack-for-google-compute-engine.html
Salt Virt
---------
Salt Virt is a cloud controller that supports virtual machine deployment,
inspection, migration and integration with many aspects of Salt.
Salt Virt has undergone a major overhaul with this release and now supports
many more features and includes a number of critical improvements.
Docker Integration
------------------
Salt now ships with :mod:`states <salt.states.dockerio>` and an :mod:`execution
module <salt.states.dockerio>` to manage Docker containers.
Substantial Testing Expansion
-----------------------------
Salt continues to increase its unit/regression test coverage. This release
includes over 300 new tests.
BSD Package Management
----------------------
BSD package management has been entirely rewritten. FreeBSD 9 and older now
default to using pkg_add, while FreeBSD 10 and newer will use pkgng. FreeBSD 9
can be forced to use pkgng, however, by specifying the following option in the
minion config file:
.. code-block:: yaml
providers:
pkg: pkgng
In addition, support for installing software from the ports tree has been
added. See the documentation for the ports :mod:`state <salt.states.ports>` and
:mod:`execution module <salt.modules.freebsdports>` for more information.
Network Management for Debian/Ubuntu
------------------------------------
Initial support for management of network interfaces on Debian-based distros
has been added. See the documentation for the :mod:`network state
<salt.states.network>` and the :mod:`debian_ip <salt.modules.debian_ip>` for
more information.
IPv6 Support for iptables State/Module
--------------------------------------
The iptables :mod:`state <salt.states.iptables>` and :mod:`module
<salt.modules.iptables>` now have IPv6 support. A new parameter ``family`` has
been added to the states and execution functions, to distinguish between IPv4
and IPv6. The default value for this parameter is ``ipv4``, specifying ``ipv6``
will use ip6tables to manage firewall rules.
GitFS Improvements
------------------
Several performance improvements have been made to the :mod:`Git fileserver
backend <salt.fileserver.gitfs>`. Additionally, file states can now use any
any SHA1 commit hash as a fileserver environment:
.. code-block:: yaml
/etc/httpd/httpd.conf:
file.managed:
- source: salt://webserver/files/httpd.conf
- saltenv: 45af879
This applies to the functions in the :mod:`cp module <salt.modules.cp>` as
well:
.. code-block:: yaml
salt '*' cp.get_file salt://readme.txt /tmp/readme.txt saltenv=45af879
MinionFS
--------
This new fileserver backend allows files which have been pushed from the minion
to the master (using :mod:`cp.push <salt.modules.cp.push>`) to be served up
from the salt fileserver. The path for these files takes the following format::
salt://minion-id/path/to/file
``minion-id`` is the id of the "source" minion, the one from which the files
were pushed to the master. ``/path/to/file`` is the full path of the file.
The :doc:`MinionFS Walkthrough </topics/tutorials/minionfs>` contains a more
thorough example of how to use this backend.
saltenv
-------
To distinguish between fileserver environments and execution functions which
deal with environment variables, fileserver environments are now specified
using the ``saltenv`` parameter. ``env`` will continue to work, but is
deprecated and will be removed in a future release.
Grains Caching
--------------
A caching layer has been added to the Grains system, which can help speed up
minion startup. Disabled by default, it can be enabled by setting the minion
config option ``grains_cache``:
.. code-block:: yaml
grains_cache: True
# Seconds before grains cache is considered to be stale.
grains_cache_expiration: 300
If set to ``True``, the grains loader will read from/write to a
msgpack-serialized file containing the grains data.
Additional command-line parameters have been added to salt-call, mainly for
testing purposes:
* ``--skip-grains`` will completely bypass the grains loader when salt-call is
invoked.
* ``--refresh-grains-cache`` will force the grains loader to bypass the grains
cache and refresh the grains, writing a new grains cache file.
Improved Command Logging Control
--------------------------------
When using the :mod:`cmd module <salt.modules.cmdmod>`, either on the CLI or
when developing Salt execution modules, a new keyword argument
``output_loglevel`` allows for greater control over how (or even if) the
command and its output are logged. For example:
.. code-block:: bash
salt '*' cmd.run 'tail /var/log/messages' output_loglevel=debug
The package management modules (``apt``, ``yumpkg``, etc.) have been updated to
log the copious output generated from these commands at loglevel ``debug``.
.. note::
To keep a command from being logged, ``output_loglevel=quiet`` can be used.
Prior to this release, this could be done using ``quiet=True``. This
argument is still supported, but will be removed in a future Salt release.
PagerDuty Support
-----------------
Initial support for firing events via PagerDuty_ has been added. See the
documentation for the :mod:`pagerduty <salt.modules.pagerduty>` module.
.. _PagerDuty: http://pagerduty.com
Virtual Terminal
----------------
Sometimes the subprocess module is not good enough, and, in fact, not even
``askpass`` is. This virtual terminal is still in it's infant childhood, needs
quite some love, and was originally created to replace ``askpass``, but, while
developing it, it immediately proved that it could do so much more. It's
currently used by salt-cloud when bootstrapping salt on clouds which require
the use of a password.
Proxy Minions
-------------
Proxy minions are a developing feature in Salt that makes it possible to
control devices that cannot run a real salt-minion. Examples include
proprietary devices, network gear, "dumb" devices without enough CPU or RAM to
handle a Python VM, and anything with a well-defined API. Even remote services
exposed over REST, for example, could be controlled with a proxy minion.
Proxy Minions¬
-------------¬
¬
Initial basic support for Proxy Minions is in this release. Documentation can¬
be found :doc:`here </topics/proxyminion>`.⌴⌴¬
¬
Proxy minions are a developing feature in Salt that enables control of¬
devices that cannot run a minion. Examples include network gear like switches¬
and routers that run a proprietary OS but offer an API, or "dumb"¬
devices that just don't have the horsepower or ability to handle a Python VM.¬
¬
Proxy minions can be difficult to write, so a simple REST-based example proxy¬
is included. A Python bottle-based webserver can be found at⌴¬
http://github.com/cro/salt-proxy-rest as an endpoint for this proxy.¬
This is an ALPHA-quality feature. There are a number of issues with it
currently, mostly centering around process control, logging, and inability to
work in a masterless configuration.
Documentation is available :doc:`here </topics/proxyminion>`.

View File

@ -12,6 +12,7 @@ import salt.transport
__proxyenabled__ = ['*']
def fire_master(data, tag, preload=None):
'''
Fire an event off up to the master server

View File

@ -12,6 +12,7 @@ import salt.utils
__proxyenabled__ = ['*']
def get(key, default=''):
'''
.. versionadded:: 0.14

View File

@ -31,16 +31,20 @@ def __virtual__():
return __virtualname__
return False
def list_pkgs(versions_as_list=False, **kwargs):
return __opts__['proxyobject'].package_list()
def install(name=None, refresh=False, fromrepo=None,
pkgs=None, sources=None, **kwargs):
return __opts__['proxyobject'].package_install(name, **kwargs)
def remove(name=None, pkgs=None, **kwargs):
return __opts__['proxyobject'].package_remove(name)
def version(*names, **kwargs):
'''
Returns a string representing the package version or an empty string if not

View File

@ -1 +1,4 @@
# -*- coding: utf-8 -*-
'''
salt.proxy package
'''

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
'''
Routines to set up a minion
Interface with a Junos device via proxy-minion.
'''
# Import python libs
@ -14,23 +14,47 @@ HAS_JUNOS = True
__proxyenabled__ = ['junos']
class Proxyconn(object):
'''
This class provides the persistent connection to the device that is being
controlled.
'''
def __init__(self, details):
self.conn = jnpr.junos.Device(user=details['username'], host=details['host'], password=details['passwd'])
'''
Open the connection to the Junos device, login, and bind to the
Resource class
'''
self.conn = jnpr.junos.Device(user=details['username'],
host=details['host'],
password=details['passwd'])
self.conn.open()
self.conn.bind(cu=jnpr.junos.cfg.Resource)
def proxytype(self):
'''
Returns the name of this proxy
'''
return 'junos'
def id(self, opts):
'''
Returns a unique ID for this proxy minion
'''
return self.conn.facts['hostname']
def ping(self):
'''
Ping? Pong!
'''
return self.conn.connected
def shutdown(self, opts):
'''
This is called when the proxy-minion is exiting to make sure the
connection to the device is closed cleanly.
'''
print('Proxy module {0} shutting down!!'.format(opts['id']))
try:

View File

@ -1,6 +1,10 @@
# -*- coding: utf-8 -*-
'''
Routines to set up a minion
This is a simple proxy-minion designed to connect to and communicate with
the bottle-based web service contained in salt/tests/rest.py.
Note this example needs the 'requests' library.
Requests is not a hard dependency for Salt
'''
# Import python libs
@ -12,58 +16,89 @@ HAS_REST_EXAMPLE = True
__proxyenabled__ = ['rest_sample']
class Proxyconn(object):
'''
Interface with the REST sample web service (rest.py at
https://github.com/cro/salt-proxy-rest)
'''
def __init__(self, details):
self.url = details['url']
self.grains_cache = {}
def id(self, opts):
'''
Return a unique ID for this proxy minion
'''
r = requests.get(self.url+'id')
return r.text.encode('ascii', 'ignore')
def proxytype(self):
'''
Return the type of proxy
'''
return 'rest_example'
def grains(self):
'''
Get the grains from the proxied device
'''
if not self.grains_cache:
r = requests.get(self.url+'info')
self.grains_cache = r.json()
return self.grains_cache
def grains_refresh(self):
self.grains_cache = {}
return self.grains()
'''
Refresh the grains from the proxied device
'''
self.grains_cache = {}
return self.grains()
def service_start(self, name):
'''
Start a "service" on the REST server
'''
r = requests.get(self.url+'service/start/'+name)
return r.json()
def service_stop(self, name):
'''
Stop a "service" on the REST server
'''
r = requests.get(self.url+'service/stop/'+name)
return r.json()
def service_restart(self, name):
'''
Restart a "service" on the REST server
'''
r = requests.get(self.url+'service/restart/'+name)
return r.json()
def service_list(self):
'''
List "services" on the REST server
'''
r = requests.get(self.url+'service/list')
return r.json()
def service_status(self, name):
'''
Check if a service is running on the REST server
'''
r = requests.get(self.url+'service/status/'+name)
return r.json()
def package_list(self):
'''
List "packages" installed on the REST server
'''
r = requests.get(self.url+'package/list')
return r.json()
def package_install(self, name, **kwargs):
'''
Install a "package" on the REST server
'''
cmd = self.url+'package/install/'+name
if 'version' in kwargs:
cmd += '/'+kwargs['version']
@ -72,14 +107,23 @@ class Proxyconn(object):
r = requests.get(cmd)
def package_remove(self, name):
'''
Remove a "package" on the REST server
'''
r = requests.get(self.url+'package/remove/'+name)
return r.json()
def package_status(self, name):
'''
Check the installation status of a package on the REST server
'''
r = requests.get(self.url+'package/status/'+name)
return r.json()
def ping(self):
'''
Is the REST server up?
'''
r = requests.get(self.url+'ping')
try:
if r.status_code == 200:
@ -89,7 +133,6 @@ class Proxyconn(object):
except Exception:
return False
def shutdown(self, opts):
'''
For this proxy shutdown is a no-op