Skip to content

Commit

Permalink
Fixed py3 compatibilities.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien Delle Cave committed Sep 4, 2019
1 parent 15118f4 commit 19e4844
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 24 deletions.
2 changes: 1 addition & 1 deletion auton/classes/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def load_conf(xfile, options = None, envvar = None):
name))
cfg['auton']['plugin_name'] = ept_cfg['plugin']

for x in ('config', 'users', 'vars'):
for x in ('vars', 'config', 'users'):
if ept_cfg.get("import_%s" % x):
cfg[x].update(import_file(ept_cfg["import_%s" % x], conf['_config_directory'], cfg))

Expand Down
31 changes: 16 additions & 15 deletions bin/auton
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ __license__ = """
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
__version__ = '0.1.50'
__version__ = '0.1.51'

import argparse
import os
Expand All @@ -39,6 +39,7 @@ from sonicprobe.libs import urisup
import requests
from requests.exceptions import ConnectionError

import six
try:
from StringIO import CStringIO as StringIO
except ImportError:
Expand All @@ -62,51 +63,51 @@ def argv_parse_check():
parser.add_argument("-a",
action = 'append',
dest = 'args',
type = unicode,
type = six.u,
default = [],
help = "Passed arguments")
parser.add_argument("-A",
action = 'append',
dest = 'argfiles',
type = unicode,
type = six.u,
default = [],
help = "Passed argument files")
parser.add_argument("--multi-args",
action = 'append',
dest = 'margs',
type = unicode,
type = six.u,
default = [],
help = "Passed multiple arguments (arguments splitted)")
parser.add_argument("--multi-argsfiles",
action = 'append',
dest = 'margsfiles',
type = unicode,
type = six.u,
default = [],
help = "Passed multiple arguments files (arguments splitted)")
parser.add_argument("--uri",
action = 'append',
dest = 'uri',
type = unicode,
type = six.u,
default = [],
help = "Auton daemon URI addresses")
parser.add_argument("--uid",
dest = 'uid',
type = unicode,
type = six.u,
default = os.environ.get('AUTON_UID') or ("%s" % uuid.uuid4()),
help = "Auton uid")
parser.add_argument("--endpoint",
dest = 'endpoint',
type = unicode,
type = six.u,
default = os.environ.get('AUTON_ENDPOINT'),
help = "Auton endpoint")
parser.add_argument("--auth-user",
dest = 'auth_user',
type = unicode,
type = six.u,
default = os.environ.get('AUTON_AUTH_USER'),
help = "Auton auth user")
parser.add_argument("--auth-passwd",
dest = 'auth_passwd',
type = unicode,
type = six.u,
default = os.environ.get('AUTON_AUTH_PASSWD'),
help = "Auton auth password")
parser.add_argument("--delay",
Expand All @@ -122,19 +123,19 @@ def argv_parse_check():
parser.add_argument("-e",
action = 'append',
dest = 'envvars',
type = unicode,
type = six.u,
default = [],
help = "Passed environment variables")
parser.add_argument("--envfile",
action = 'append',
dest = 'envfiles',
type = unicode,
type = six.u,
default = [],
help = "Passed envfile parameters")
parser.add_argument("--load-envfile",
action = 'append',
dest = 'load_envfiles',
type = unicode,
type = six.u,
default = [],
help = "Load environment variables from file")
parser.add_argument("-l",
Expand All @@ -145,7 +146,7 @@ def argv_parse_check():
"critical, error, warning, info, debug"))
parser.add_argument("--logfile",
dest = 'logfile',
type = unicode,
type = six.u,
default = AUTON_LOGFILE,
help = "Use log file <logfile> instead of %(default)s")
parser.add_argument("--no-return-code",
Expand Down Expand Up @@ -343,7 +344,7 @@ def main(options):
format = xformat,
datefmt = datefmt)

logdir = os.path.dirname(options.logfile)
logdir = os.path.dirname(options.logfile)
if os.path.isdir(logdir) and os.access(logdir, os.W_OK):
filehandler = WatchedFileHandler(options.logfile)
filehandler.setFormatter(logging.Formatter(xformat,
Expand Down
15 changes: 8 additions & 7 deletions bin/autond
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ __license__ = """
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
__version__ = '0.1.50'
__version__ = '0.1.51'

import argparse
import logging
import grp
import os
import pwd
import six

from dwho.modules import * # XXX
from dwho.config import init_logger, make_piddir, make_logdir
Expand Down Expand Up @@ -84,32 +85,32 @@ def argv_parse_check():
help = "Foreground, don't daemonize")
parser.add_argument("-c",
dest = 'conffile',
type = unicode,
type = six.u,
default = '/etc/auton/auton.yml',
help = "Use configuration file <conffile> instead of %(default)s")
parser.add_argument("-p",
dest = 'pidfile',
type = unicode,
type = six.u,
default = AUTOND_PIDFILE,
help = "Use PID file <pidfile> instead of %(default)s")
parser.add_argument("-u",
dest = 'username',
type = unicode,
type = six.u,
default = AUTON_USER,
help = "Use username for the process instead of %(default)s")
parser.add_argument("-g",
dest = 'groupname',
type = unicode,
type = six.u,
default = AUTON_GROUP,
help = "Use groupname for the process instead of %(default)s")
parser.add_argument("--logfile",
dest = 'logfile',
type = unicode,
type = six.u,
default = AUTOND_LOGFILE,
help = "Use log file <logfile> instead of %(default)s")
parser.add_argument("--listen-addr",
dest = 'listen_addr',
type = unicode,
type = six.u,
help = "Listen on address <listen_addr>")
parser.add_argument("--listen-port",
dest = 'listen_port',
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
auton (0.1.51) unstable; urgency=medium

* Fixed py3 compatibilities.

-- Adrien DELLE CAVE <adrien.delle.cave@commandersact.com> Wed, 04 Sep 2019 18:10:20 +0200

auton (0.1.50) unstable; urgency=medium

* Reviewed README.md.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
from setuptools import find_packages, setup

version = '0.1.50'
version = '0.1.51'

current_dir = os.path.abspath(os.path.dirname(__file__))

Expand Down

0 comments on commit 19e4844

Please sign in to comment.