diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2022-10-11 14:46:32 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2022-10-11 14:46:57 +0200 |
commit | 36701580caf57788f6900fb6d28e4274909f6a34 (patch) | |
tree | 5bada7be4f3b45e9b17d9b0dbff465a1fcbb731d /lib | |
parent | 68838a0cb2a2e5dbaca9c3c63178238cf988f4b4 (diff) |
postmulti: Fix encoding issue.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/modules/postmulti | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/modules/postmulti b/lib/modules/postmulti index 3c0a522..e6f58e3 100644 --- a/lib/modules/postmulti +++ b/lib/modules/postmulti @@ -13,66 +13,66 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Look up postfix configuration variable def postconf(k, instance=None): if instance: cmd = [ os.path.join(os.sep, 'usr', 'sbin', 'postmulti') , '-x' , '-i', instance , '--' ] else: cmd = [] cmd.extend([ os.path.join(os.sep, 'usr', 'sbin', 'postconf') , '-h', k ]) - return subprocess.check_output(cmd, stderr=subprocess.STDOUT).rstrip() + return subprocess.check_output(cmd, stderr=subprocess.STDOUT).rstrip().decode("utf-8") # To destroy an existing instance: # postmulti -e disable -i mx # postmulti -e destroy -i mx def main(): module = AnsibleModule( argument_spec = dict( instance = dict( required=True ), group = dict( required=False ) ), supports_check_mode=True ) params = module.params instance = params['instance'] group = params['group'] changed=False try: enable = postconf('multi_instance_enable') wrapper = postconf('multi_instance_wrapper') - if enable != "yes" or not wrapper: + if enable != "yes" or wrapper == "": # Initiate postmulti changed = True if module.check_mode: module.exit_json(changed=changed, msg="init postmulti") cmd = [ os.path.join(os.sep, 'usr', 'sbin', 'postmulti') ] cmd.extend([ '-e', 'init' ]) subprocess.check_output(cmd, stderr=subprocess.STDOUT).rstrip() instances = postconf('multi_instance_directories').split() if os.path.join(os.sep, 'etc', 'postfix-%s' % instance) not in instances: changed = True # Create the instance if module.check_mode: module.exit_json(changed=changed, msg="create postmulti") cmd = [ os.path.join(os.sep, 'usr', 'sbin', 'postmulti') ] cmd.extend([ '-e', 'create' ]) if group: cmd.extend([ '-G', group ]) cmd.extend([ '-I', 'postfix-%s' % instance ]) |