From: Ralf Jung Date: Tue, 3 Jan 2023 12:37:44 +0000 (+0100) Subject: migrate things to python3 X-Git-Url: https://git.ralfj.de/ansible.git/commitdiff_plain/fdb23fdc21e9474901e06169ab01a8fac78ab26f?ds=sidebyside;hp=2f2bd6804c18cdddc86cb3883ff8482c7cc7612f migrate things to python3 --- diff --git a/roles/apache/files/log-anon b/roles/apache/files/log-anon index 32b6c1e..0b84668 100644 --- a/roles/apache/files/log-anon +++ b/roles/apache/files/log-anon @@ -1,9 +1,9 @@ -#!/usr/bin/python +#!/usr/bin/python3 import sys, re from netaddr import IPAddress, AddrFormatError if len(sys.argv) != 2: - print >>sys.stderr, "Usage: %s filename" % sys.argv[0] + print("Usage: %s filename" % sys.argv[0], file=sys.stderr) sys.exit(1) log = open(sys.argv[1], "a") diff --git a/roles/apache/tasks/main.yml b/roles/apache/tasks/main.yml index 6878845..8d1382c 100644 --- a/roles/apache/tasks/main.yml +++ b/roles/apache/tasks/main.yml @@ -1,5 +1,5 @@ - name: install apache - apt: name=apache2,python-netaddr state=latest + apt: name=apache2,python3-netaddr state=latest - name: enable apache service: name=apache2 enabled=yes # apache config diff --git a/roles/email/tasks/dovecot.yml b/roles/email/tasks/dovecot.yml index 5d8ef0c..1766ede 100644 --- a/roles/email/tasks/dovecot.yml +++ b/roles/email/tasks/dovecot.yml @@ -1,5 +1,5 @@ - name: install dovecot - apt: name=dovecot-imapd,dovecot-lmtpd,dovecot-mysql,dovecot-pop3d,dovecot-sieve,dovecot-managesieved state=latest + apt: name=dovecot-imapd,dovecot-lmtpd,dovecot-mysql,dovecot-pop3d,dovecot-sieve,dovecot-managesieved,python3-mysqldb state=latest - name: enable dovecot service: name=dovecot enabled=yes # configuration diff --git a/roles/email/templates/changepw b/roles/email/templates/changepw index 96eef60..7a1b600 100644 --- a/roles/email/templates/changepw +++ b/roles/email/templates/changepw @@ -1,5 +1,5 @@ -#!/usr/bin/env python2 -from __future__ import print_function +#!/usr/bin/env python3 + import os, cgi, MySQLdb, subprocess, time # settings diff --git a/roles/email/templates/newmail/newmail b/roles/email/templates/newmail/newmail index 86a1d99..4f37859 100755 --- a/roles/email/templates/newmail/newmail +++ b/roles/email/templates/newmail/newmail @@ -1,8 +1,8 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- -from __future__ import print_function + import sys, os, random, MySQLdb, subprocess, time, string, argparse -import urllib, smtplib, email.mime.text, email.utils +import smtplib, email.mime.text, email.utils from settings import * from templates import *