Py3 compatibility fixes.

This commit is contained in:
Pedro Algarvio 2014-11-23 18:24:28 +00:00
parent 7d0e0c2d08
commit 142a4a270a

View File

@ -2,16 +2,16 @@
'''
Run nagios plugins/checks from salt and get the return as data.
'''
from __future__ import absolute_import
# Import python libs
from __future__ import absolute_import
import os
import stat
# Import salt libs
import logging
# Import 3rd-party libs
import salt.ext.six as six
log = logging.getLogger(__name__)
PLUGINDIR = '/usr/lib/nagios/plugins/'
@ -63,10 +63,10 @@ def _execute_pillar(pillar_name, run_type):
data[group] = {}
commands = groups[group]
for command in commands:
#Check if is a dict to get the arguments
#in command if not set the arguments to empty string
# Check if is a dict to get the arguments
# in command if not set the arguments to empty string
if isinstance(command, dict):
plugin = next(command.iterkeys())
plugin = next(six.iterkeys(command))
args = command[plugin]
else:
plugin = command
@ -165,10 +165,10 @@ def retcode_pillar(pillar_name):
for group in groups:
commands = groups[group]
for command in commands:
#Check if is a dict to get the arguments
#in command if not set the arguments to empty string
# Check if is a dict to get the arguments
# in command if not set the arguments to empty string
if isinstance(command, dict):
plugin = next(command.iterkeys())
plugin = next(six.iterkeys(command))
args = command[plugin]
else:
plugin = command