Merge pull request #24644 from cro/2014.7-2015.5-20150612

Merge forward 2014.7->2015.5
This commit is contained in:
Shane Lee 2015-06-12 15:31:41 -06:00
commit 89eb616c29
3 changed files with 21 additions and 20 deletions

View File

@ -118,6 +118,12 @@ https://groups.google.com/forum/#!forum/salt-users
.. _`salt-users mailing list`: https://groups.google.com/forum/#!forum/salt-users
There is also a low-traffic list used to announce new releases
called `salt-announce`_
https://groups.google.com/forum/#!forum/salt-announce
.. _`salt-announce`: https://groups.google.com/forum/#!forum/salt-announce
IRC
===

View File

@ -982,13 +982,12 @@ def uncomment(path,
salt '*' file.uncomment /etc/hosts.deny 'ALL: PARANOID'
'''
# Largely inspired by Fabric's contrib.files.uncomment()
return sed(path,
before=r'^([[:space:]]*){0}'.format(char),
after=r'\1',
limit=regex.lstrip('^'),
backup=backup)
pattern = '^{0}{1}'.format(char, regex.lstrip('^').rstrip('$'))
repl = "{0}".format(regex.lstrip('^').rstrip('$'))
return replace(path=path,
pattern=pattern,
repl=repl,
backup=backup)
def comment(path,
@ -1026,17 +1025,11 @@ def comment(path,
salt '*' file.comment /etc/modules pcspkr
'''
# Largely inspired by Fabric's contrib.files.comment()
regex = '{0}({1}){2}'.format(
'^' if regex.startswith('^') else '',
regex.lstrip('^').rstrip('$'),
'$' if regex.endswith('$') else '')
return sed(path,
before=regex,
after=r'{0}\1'.format(char),
backup=backup)
repl = "{0}{1}".format(char, regex.lstrip('^').rstrip('$'))
return replace(path=path,
pattern=regex,
repl=repl,
backup=backup)
def _get_flags(flags):

View File

@ -57,7 +57,7 @@ from salt.modules.file import (check_hash, # pylint: disable=W0611
access, copy, readdir, rmdir, truncate, replace, delete_backup,
search, _get_flags, extract_hash, _error, _sed_esc, _psed,
RE_FLAG_TABLE, blockreplace, prepend, seek_read, seek_write, rename,
lstat, path_exists_glob, HASHES)
lstat, path_exists_glob, HASHES, comment, uncomment)
from salt.utils import namespaced_function as _namespaced_function
@ -83,7 +83,7 @@ def __virtual__():
global access, copy, readdir, rmdir, truncate, replace, search
global _binary_replace, _get_bkroot, list_backups, restore_backup
global blockreplace, prepend, seek_read, seek_write, rename, lstat
global path_exists_glob, _mkstemp_copy
global path_exists_glob, comment, uncomment, _mkstemp_copy
replace = _namespaced_function(replace, globals())
search = _namespaced_function(search, globals())
@ -133,6 +133,8 @@ def __virtual__():
rename = _namespaced_function(rename, globals())
lstat = _namespaced_function(lstat, globals())
path_exists_glob = _namespaced_function(path_exists_glob, globals())
comment = _namespaced_function(comment, globals())
uncomment = _namespaced_function(uncomment, globals())
_mkstemp_copy = _namespaced_function(_mkstemp_copy, globals())
return __virtualname__