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

[2015.8] Merge forward from 2015.5 to 2015.8 #31549

Merged
merged 14 commits into from Feb 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 16 additions & 9 deletions Contributing.rst
Expand Up @@ -13,17 +13,18 @@ Please read the following guidelines before you `report an issue`_
1. **Use the GitHub issue search** — check if the issue has
already been reported. If it has been, please comment on the existing issue.

2. **Check if the issue has been fixed** — the latest `develop`
branch may already contain a fix. Please try to reproduce the bug against
the latest git head or the latest release.
2. **Check if the issue has been fixed** — Various point-release branches, such
as ``2015.5``, ``2015.8``, ``2016.3``, or even ``develop``, may already contain
a fix. Please try to reproduce the bug against the latest git HEAD or the latest
release.

3. **Isolate the demonstrable problem** — make sure that the
code in the project's repository is *definitely* responsible for the issue.

4. **Include a reproducible example** — Provide the steps which
led you to the problem.

Please try to be as detailed as possible in your report too. What is your
Please try to be as detailed as possible in your report, too. What is your
environment? What steps will reproduce the issue? What Operating System? What
would you expect to be the outcome? All these details will help people to
assess and fix any potential bugs.
Expand All @@ -38,26 +39,30 @@ Features

Salt is always working to be more powerful. Feature additions and requests are
welcomed. When requesting a feature it will be categorized for a release or
placed under "Approved for Future Release".
placed under the "Feature" label.

If a new feature is desired, the fastest way to get it into Salt is to
contribute the code. Before starting on a new feature an issue should be filed
contribute the code. Before starting on a new feature, an issue should be filed
for it. The one requesting the feature will be able to then discuss the feature
with the Salt team and discover the best way to get the feature into Salt and
if the feature makes sense.

It is extremely common that the desired feature has already been completed,
look for it in the docs, ask about it first in IRC, and on the mailing list
It is extremely common that the desired feature has already been completed.
Look for it in the docs, ask about it first in IRC, and on the mailing list
before filing the request. It is also common that the problem which would be
solved by the new feature can be easily solved another way, which is a great
reason to ask first.

Fixing issues
=============

If you wish to help us fixing the issue you're reporting, `Salt's documentation`_ already includes
If you wish to help us fix the issue you're reporting, `Salt's documentation`_ already includes
information to help you setup a development environment, under `Developing Salt`_.

`SaltStack's Contributing documentation`_ is also helpful, as it explains sending in pull requests,
keeping your salt branches in sync, and knowing `which branch`_ new features or bug fixes should be
submitted against.

Fix the issue you have in hands, if possible also add a test case to Salt's testing suite, create a
`pull request`_, and **that's it**!

Expand All @@ -69,5 +74,7 @@ salt's code.
.. _`Salt's documentation`: http://docs.saltstack.com/en/latest/index.html
.. _`Developing Salt`: http://docs.saltstack.com/en/latest/topics/development/hacking.html
.. _`pull request`: http://docs.saltstack.com/en/latest/topics/development/contributing.html#sending-a-github-pull-request
.. _`SaltStack's Contributing documentation`: https://docs.saltstack.com/en/latest/topics/development/contributing.html
.. _`which branch`: https://docs.saltstack.com/en/latest/topics/development/contributing.html#which-salt-branch

.. vim: fenc=utf-8 spell spl=en
1 change: 0 additions & 1 deletion doc/topics/ssh/roster.rst
Expand Up @@ -47,7 +47,6 @@ The information which can be stored in a roster ``target`` is the following:
priv: # File path to ssh private key, defaults to salt-ssh.rsa
timeout: # Number of seconds to wait for response when establishing
# an SSH connection
timeout: # Number of seconds to wait for response
minion_opts: # Dictionary of minion opts
thin_dir: # The target system's storage directory for Salt
# components. Defaults to /tmp/salt-<hash>.
Expand Down
7 changes: 4 additions & 3 deletions salt/client/ssh/state.py
Expand Up @@ -121,7 +121,7 @@ def salt_refs(data, ret=None):
return ret


def prep_trans_tar(file_client, chunks, file_refs, pillar=None):
def prep_trans_tar(file_client, chunks, file_refs, pillar=None, id_=None):
'''
Generate the execution package from the saltenv file refs and a low state
data structure
Expand All @@ -144,6 +144,7 @@ def prep_trans_tar(file_client, chunks, file_refs, pillar=None):
if pillar:
with salt.utils.fopen(pillarfn, 'w+') as fp_:
fp_.write(json.dumps(pillar))
cachedir = os.path.join('salt-ssh', id_)
for saltenv in file_refs:
file_refs[saltenv].extend(sync_refs)
env_root = os.path.join(gendir, saltenv)
Expand All @@ -152,15 +153,15 @@ def prep_trans_tar(file_client, chunks, file_refs, pillar=None):
for ref in file_refs[saltenv]:
for name in ref:
short = salt.utils.url.parse(name)[0]
path = file_client.cache_file(name, saltenv)
path = file_client.cache_file(name, saltenv, cachedir=cachedir)
if path:
tgt = os.path.join(env_root, short)
tgt_dir = os.path.dirname(tgt)
if not os.path.isdir(tgt_dir):
os.makedirs(tgt_dir)
shutil.copy(path, tgt)
continue
files = file_client.cache_dir(name, saltenv)
files = file_client.cache_dir(name, saltenv, cachedir=cachedir)
if files:
for filename in files:
fn = filename[filename.find(short) + len(short):]
Expand Down
16 changes: 13 additions & 3 deletions salt/client/ssh/wrapper/cp.py
Expand Up @@ -7,6 +7,7 @@
# Import salt libs
import salt.client.ssh
import logging
import os
from salt.exceptions import CommandExecutionError

log = logging.getLogger(__name__)
Expand All @@ -33,7 +34,10 @@ def get_file(path,
if template is not None:
(path, dest) = _render_filenames(path, dest, saltenv, template)

src = __context__['fileclient'].cache_file(path, saltenv)
src = __context__['fileclient'].cache_file(
path,
saltenv,
cachedir=os.path.join('salt-ssh', __salt__.kwargs['id_']))
single = salt.client.ssh.Single(
__opts__,
'',
Expand All @@ -46,7 +50,10 @@ def get_dir(path, dest, saltenv='base'):
'''
Transfer a directory down
'''
src = __context__['fileclient'].cache_dir(path, saltenv)
src = __context__['fileclient'].cache_dir(
path,
saltenv,
cachedir=os.path.join('salt-ssh', __salt__.kwargs['id_']))
src = ' '.join(src)
single = salt.client.ssh.Single(
__opts__,
Expand All @@ -60,7 +67,10 @@ def get_url(path, dest, saltenv='base'):
'''
retrive a URL
'''
src = __context__['fileclient'].get_url(path, saltenv)
src = __context__['fileclient'].get_url(
path,
saltenv,
cachedir=os.path.join('salt-ssh', __salt__.kwargs['id_']))
single = salt.client.ssh.Single(
__opts__,
'',
Expand Down
25 changes: 18 additions & 7 deletions salt/client/ssh/wrapper/state.py
Expand Up @@ -94,11 +94,13 @@ def sls(mods, saltenv='base', test=None, exclude=None, env=None, **kwargs):
__opts__.get('extra_filerefs', '')
)
)
# Create the tar containing the state pkg and relevant files.
trans_tar = salt.client.ssh.state.prep_trans_tar(
__context__['fileclient'],
chunks,
file_refs,
__pillar__)
__pillar__,
id_=st_kwargs['id_'])
trans_tar_sum = salt.utils.get_hash(trans_tar, __opts__['hash_type'])
cmd = 'state.pkg {0}/salt_state.tgz test={1} pkg_sum={2} hash_type={3}'.format(
__opts__['thin_dir'],
Expand Down Expand Up @@ -161,11 +163,13 @@ def low(data, **kwargs):
__opts__.get('extra_filerefs', '')
)
)
# Create the tar containing the state pkg and relevant files.
trans_tar = salt.client.ssh.state.prep_trans_tar(
__context__['fileclient'],
chunks,
file_refs,
__pillar__)
__pillar__,
id_=st_kwargs['id_'])
trans_tar_sum = salt.utils.get_hash(trans_tar, __opts__['hash_type'])
cmd = 'state.pkg {0}/salt_state.tgz pkg_sum={1} hash_type={2}'.format(
__opts__['thin_dir'],
Expand Down Expand Up @@ -225,11 +229,13 @@ def high(data, **kwargs):
__opts__.get('extra_filerefs', '')
)
)
# Create the tar containing the state pkg and relevant files.
trans_tar = salt.client.ssh.state.prep_trans_tar(
__context__['fileclient'],
chunks,
file_refs,
__pillar__)
__pillar__,
id_=st_kwargs['id_'])
trans_tar_sum = salt.utils.get_hash(trans_tar, __opts__['hash_type'])
cmd = 'state.pkg {0}/salt_state.tgz pkg_sum={1} hash_type={2}'.format(
__opts__['thin_dir'],
Expand Down Expand Up @@ -317,11 +323,13 @@ def highstate(test=None, **kwargs):
for chunk in chunks:
if not isinstance(chunk, dict):
return chunks
# Create the tar containing the state pkg and relevant files.
trans_tar = salt.client.ssh.state.prep_trans_tar(
__context__['fileclient'],
chunks,
file_refs,
__pillar__)
__pillar__,
id_=st_kwargs['id_'])
trans_tar_sum = salt.utils.get_hash(trans_tar, __opts__['hash_type'])
cmd = 'state.pkg {0}/salt_state.tgz test={1} pkg_sum={2} hash_type={3}'.format(
__opts__['thin_dir'],
Expand Down Expand Up @@ -388,11 +396,13 @@ def top(topfn, test=None, **kwargs):
__opts__.get('extra_filerefs', '')
)
)
# Create the tar containing the state pkg and relevant files.
trans_tar = salt.client.ssh.state.prep_trans_tar(
__context__['fileclient'],
chunks,
file_refs,
__pillar__)
__pillar__,
id_=st_kwargs['id_'])
trans_tar_sum = salt.utils.get_hash(trans_tar, __opts__['hash_type'])
cmd = 'state.pkg {0}/salt_state.tgz test={1} pkg_sum={2} hash_type={3}'.format(
__opts__['thin_dir'],
Expand Down Expand Up @@ -605,12 +615,13 @@ def single(fun, name, test=None, **kwargs):
)
)

# Create the tar containing the state pkg and relevant files
# Create the tar containing the state pkg and relevant files.
trans_tar = salt.client.ssh.state.prep_trans_tar(
__context__['fileclient'],
chunks,
file_refs,
__pillar__)
__pillar__,
id_=st_kwargs['id_'])

# Create a hash so we can verify the tar on the target system
trans_tar_sum = salt.utils.get_hash(trans_tar, __opts__['hash_type'])
Expand Down