From d7a9999be16f6b92fa3e82033960b3fdc3bc9d5a Mon Sep 17 00:00:00 2001 From: twangboy Date: Thu, 11 Jun 2015 20:34:57 -0600 Subject: [PATCH 1/2] Fixed comment and uncomment functions in file.py --- salt/modules/file.py | 29 +++++++++++------------------ salt/modules/win_file.py | 6 ++++-- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/salt/modules/file.py b/salt/modules/file.py index 17a516ea89..aa8172f095 100644 --- a/salt/modules/file.py +++ b/salt/modules/file.py @@ -920,13 +920,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, @@ -964,17 +963,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): diff --git a/salt/modules/win_file.py b/salt/modules/win_file.py index f2a11637e0..2bb4651b47 100644 --- a/salt/modules/win_file.py +++ b/salt/modules/win_file.py @@ -54,7 +54,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 @@ -80,7 +80,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 + global path_exists_glob, comment, uncomment replace = _namespaced_function(replace, globals()) search = _namespaced_function(search, globals()) @@ -130,6 +130,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()) return __virtualname__ return False From ecb0623d7f3d4d71b7c541799cf91d56acde28be Mon Sep 17 00:00:00 2001 From: "C. R. Oldham" Date: Fri, 12 Jun 2015 14:19:27 -0600 Subject: [PATCH 2/2] Add salt-announce mailing list. --- doc/topics/index.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/topics/index.rst b/doc/topics/index.rst index 08f277b7aa..d778806899 100644 --- a/doc/topics/index.rst +++ b/doc/topics/index.rst @@ -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 ===