Merge forward from 2014.7 to 2015.5

This commit is contained in:
C. R. Oldham 2015-06-12 14:24:46 -06:00
commit 4136dc3160
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,12 +982,11 @@ 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('^'),
pattern = '^{0}{1}'.format(char, regex.lstrip('^').rstrip('$'))
repl = "{0}".format(regex.lstrip('^').rstrip('$'))
return replace(path=path,
pattern=pattern,
repl=repl,
backup=backup)
@ -1026,16 +1025,10 @@ 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),
repl = "{0}{1}".format(char, regex.lstrip('^').rstrip('$'))
return replace(path=path,
pattern=regex,
repl=repl,
backup=backup)

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__