Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2016.3] Merge forward from 2015.8 to 2016.3 #33945

Merged
merged 24 commits into from
Jun 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
eaf42ca
solve AttributeError: 'module' object has no attribute 'exception'
May 29, 2016
1dd15a6
solve' TypeError: expected string or buffer' in json/decoder.py
May 29, 2016
137f0b1
Merge pull request #33611 from TargetHolding/2015.5
Jun 2, 2016
ebee8a8
glance.warn_until shouldn't be checked for a doc string
Jun 2, 2016
b913332
Merge pull request #33726 from jtand/sysmod_skip_valid_docs_glance
Jun 3, 2016
a5fb6d7
Fix minor docstring issues
sacren Jun 5, 2016
fa983e9
Merge pull request #33778 from sodium-chloride/2015.5-2016-0604-1938
Jun 6, 2016
897a716
Support extraction of XZ archives in archive.extracted state
terminalmage Jun 7, 2016
e061788
Merge pull request #33814 from terminalmage/archive-extracted-xz
Jun 7, 2016
f7028eb
Update versionchanged directive
terminalmage Jun 7, 2016
91745c2
Support syncing pillar modules to masterless minions
terminalmage Jun 7, 2016
b8e6c14
Merge pull request #33833 from terminalmage/issue33645
Jun 8, 2016
cdda593
Merge pull request #33829 from terminalmage/update-versionchanged
Jun 8, 2016
b8e4706
Merge branch '2015.5' into '2015.8'
Jun 8, 2016
398534a
Fix ret return from merge-conflict resolution
Jun 8, 2016
1f9422e
utils.http.query: also except gaierror with tornado
jfindlay Jun 7, 2016
82f9542
modules.random_org unit tests: skip if random.org down
jfindlay Jun 7, 2016
6acee3c
modules.random_org._query: only return text if present
jfindlay Jun 9, 2016
ef6da0b
Merge pull request #33877 from rallytime/merge-2015.8
Jun 9, 2016
91a2184
Wait for up to a minute for sync_after_install (#33917)
techhat Jun 10, 2016
2dc1914
Add connecting_settings to boto_elb state attributes list (#33936)
Jun 10, 2016
378dd7c
Merge pull request #33888 from jfindlay/random_check
Jun 10, 2016
b3ec39d
Correct issue with ping on rotate with minion cache (#33765)
Jun 10, 2016
b4ab322
Merge branch '2015.8' into '2016.3'
Jun 10, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions salt/cloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1285,29 +1285,34 @@ def create(self, vm_, local_master=True):
log.error('Bad option for sync_after_install')
return output

# a small pause makes the sync work reliably
# A small pause helps the sync work more reliably
time.sleep(3)

mopts_ = salt.config.DEFAULT_MINION_OPTS
conf_path = '/'.join(self.opts['conf_file'].split('/')[:-1])
mopts_.update(
salt.config.minion_config(
os.path.join(conf_path,
'minion')
start = int(time.time())
while int(time.time()) < start + 60:
# We'll try every <timeout> seconds, up to a minute
mopts_ = salt.config.DEFAULT_MINION_OPTS
conf_path = '/'.join(self.opts['conf_file'].split('/')[:-1])
mopts_.update(
salt.config.minion_config(
os.path.join(conf_path,
'minion')
)
)
)

client = salt.client.get_local_client(mopts=self.opts)
client = salt.client.get_local_client(mopts=self.opts)

ret = client.cmd(
vm_['name'],
'saltutil.sync_{0}'.format(self.opts['sync_after_install']),
timeout=self.opts['timeout']
)
log.info(
six.u('Synchronized the following dynamic modules: '
' {0}').format(ret)
)
ret = client.cmd(
vm_['name'],
'saltutil.sync_{0}'.format(self.opts['sync_after_install']),
timeout=self.opts['timeout']
)
if ret:
log.info(
six.u('Synchronized the following dynamic modules: '
' {0}').format(ret)
)
break
except KeyError as exc:
log.exception(
'Failed to create VM {0}. Configuration value {1} needs '
Expand Down
2 changes: 1 addition & 1 deletion salt/modules/random_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def _query(api_version=None, data=None):
elif result.get('status', None) == salt.ext.six.moves.http_client.NO_CONTENT:
return False
else:
ret['message'] = result.text
ret['message'] = result.text if hasattr(result, 'text') else ''
return ret


Expand Down
66 changes: 62 additions & 4 deletions salt/modules/saltutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,12 @@ def sync_beacons(saltenv=None, refresh=True):
will be performed even if no new beacons are synced. Set to ``False``
to prevent this refresh.

CLI Examples:
CLI Example:

.. code-block:: bash

salt '*' saltutil.sync_beacons
salt '*' saltutil.sync_beacons saltenv=dev
salt '*' saltutil.sync_beacons saltenv=base,dev
'''
ret = _sync('beacons', saltenv)
Expand All @@ -210,11 +211,16 @@ def sync_sdb(saltenv=None):
The fileserver environment from which to sync. To sync from more than
one environment, pass a comma-separated list.

CLI Examples:
refresh : False
This argument has no affect and is included for consistency with the
other sync functions.

CLI Example:

.. code-block:: bash

salt '*' saltutil.sync_sdb
salt '*' saltutil.sync_sdb saltenv=dev
salt '*' saltutil.sync_sdb saltenv=base,dev
'''
ret = _sync('sdb', saltenv)
Expand Down Expand Up @@ -253,11 +259,12 @@ def sync_modules(saltenv=None, refresh=True):
See :ref:`here <reloading-modules>` for a more detailed explanation of
why this is necessary.

CLI Examples:
CLI Example:

.. code-block:: bash

salt '*' saltutil.sync_modules
salt '*' saltutil.sync_modules saltenv=dev
salt '*' saltutil.sync_modules saltenv=base,dev
'''
ret = _sync('modules', saltenv)
Expand Down Expand Up @@ -286,6 +293,7 @@ def sync_states(saltenv=None, refresh=True):
.. code-block:: bash

salt '*' saltutil.sync_states
salt '*' saltutil.sync_states saltenv=dev
salt '*' saltutil.sync_states saltenv=base,dev
'''
ret = _sync('states', saltenv)
Expand Down Expand Up @@ -315,6 +323,7 @@ def sync_grains(saltenv=None, refresh=True):
.. code-block:: bash

salt '*' saltutil.sync_grains
salt '*' saltutil.sync_grains saltenv=dev
salt '*' saltutil.sync_grains saltenv=base,dev
'''
ret = _sync('grains', saltenv)
Expand Down Expand Up @@ -345,6 +354,7 @@ def sync_renderers(saltenv=None, refresh=True):
.. code-block:: bash

salt '*' saltutil.sync_renderers
salt '*' saltutil.sync_renderers saltenv=dev
salt '*' saltutil.sync_renderers saltenv=base,dev
'''
ret = _sync('renderers', saltenv)
Expand Down Expand Up @@ -373,6 +383,7 @@ def sync_returners(saltenv=None, refresh=True):
.. code-block:: bash

salt '*' saltutil.sync_returners
salt '*' saltutil.sync_returners saltenv=dev
'''
ret = _sync('returners', saltenv)
if refresh:
Expand Down Expand Up @@ -400,6 +411,7 @@ def sync_proxymodules(saltenv=None, refresh=False):
.. code-block:: bash

salt '*' saltutil.sync_proxymodules
salt '*' saltutil.sync_proxymodules saltenv=dev
salt '*' saltutil.sync_proxymodules saltenv=base,dev
'''
ret = _sync('proxy', saltenv)
Expand Down Expand Up @@ -454,6 +466,7 @@ def sync_output(saltenv=None, refresh=True):
.. code-block:: bash

salt '*' saltutil.sync_output
salt '*' saltutil.sync_output saltenv=dev
salt '*' saltutil.sync_output saltenv=base,dev
'''
ret = _sync('output', saltenv)
Expand Down Expand Up @@ -484,6 +497,7 @@ def sync_utils(saltenv=None, refresh=True):
.. code-block:: bash

salt '*' saltutil.sync_utils
salt '*' saltutil.sync_utils saltenv=dev
salt '*' saltutil.sync_utils saltenv=base,dev
'''
ret = _sync('utils', saltenv)
Expand Down Expand Up @@ -512,6 +526,7 @@ def sync_log_handlers(saltenv=None, refresh=True):
.. code-block:: bash

salt '*' saltutil.sync_log_handlers
salt '*' saltutil.sync_log_handlers saltenv=dev
salt '*' saltutil.sync_log_handlers saltenv=base,dev
'''
ret = _sync('log_handlers', saltenv)
Expand All @@ -520,8 +535,47 @@ def sync_log_handlers(saltenv=None, refresh=True):
return ret


def sync_pillar(saltenv=None, refresh=True):
'''
.. versionadded:: 2015.8.11,2016.3.2

Sync pillar modules from the ``salt://_pillar`` directory on the Salt
fileserver. This function is environment-aware, pass the desired
environment to grab the contents of the ``_pillar`` directory from that
environment. The default environment, if none is specified, is ``base``.

refresh : True
Also refresh the execution modules available to the minion, and refresh
pillar data.

.. note::
This function will raise an error if executed on a traditional (i.e.
not masterless) minion

CLI Examples:

.. code-block:: bash

salt '*' saltutil.sync_pillar
salt '*' saltutil.sync_pillar saltenv=dev
'''
if __opts__['file_client'] != 'local':
raise CommandExecutionError(
'Pillar modules can only be synced to masterless minions'
)
ret = _sync('pillar', saltenv)
if refresh:
refresh_modules()
refresh_pillar()
return ret


def sync_all(saltenv=None, refresh=True):
'''
.. versionchanged:: 2015.8.11,2016.3.2
On masterless minions, pillar modules are now synced, and refreshed
when ``refresh`` is set to ``True``.

Sync down all of the dynamic modules from the file server for a specific
environment. This function synchronizes custom modules, states, beacons,
grains, returners, output modules, renderers, and utils.
Expand Down Expand Up @@ -553,6 +607,7 @@ def sync_all(saltenv=None, refresh=True):
.. code-block:: bash

salt '*' saltutil.sync_all
salt '*' saltutil.sync_all saltenv=dev
salt '*' saltutil.sync_all saltenv=base,dev
'''
log.debug('Syncing all')
Expand All @@ -569,9 +624,12 @@ def sync_all(saltenv=None, refresh=True):
ret['log_handlers'] = sync_log_handlers(saltenv, False)
ret['proxymodules'] = sync_proxymodules(saltenv, False)
ret['engines'] = sync_engines(saltenv, False)
if __opts__['file_client'] == 'local':
ret['pillar'] = sync_pillar(saltenv, False)
if refresh:
refresh_modules()
refresh_pillar()
if __opts__['file_client'] == 'local':
refresh_pillar()
return ret


Expand Down
2 changes: 1 addition & 1 deletion salt/returners/sqlite3_return.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def get_load(jid):
{'jid': jid})
data = cur.fetchone()
if data:
return json.loads(data)
return json.loads(data[0].encode())
_close_conn(conn)
return {}

Expand Down
Loading