@@ -4,7 +4,7 @@
in here
'''

import cPickle as pickle
import pickle

try:
# Attempt to import msgpack
@@ -8,4 +8,4 @@ def returner(ret):
'''
Print the return data to the terminal to verify functionality
'''
print ret
print(ret)
@@ -35,9 +35,9 @@ def _print_docs(self):
'''
for fun in sorted(self.functions):
if fun.startswith(self.opts['fun']):
print fun + ':'
print self.functions[fun].__doc__
print ''
print(fun + ':')
print(self.functions[fun].__doc__)
print('')

def run(self):
'''
@@ -49,7 +49,7 @@ def active():
continue
if os.path.exists(os.path.join(jid_dir, minion)):
ret[jid]['Returned'].append(minion)
print yaml.dump(ret)
print(yaml.dump(ret))


def lookup_jid(jid):
@@ -111,5 +111,5 @@ def list_jobs():
'Arguments': list(load['arg']),
'Target': load['tgt'],
'Target-type': load['tgt_type']}
print yaml.dump(ret)
print(yaml.dump(ret))

@@ -17,7 +17,7 @@ def down():
keys = key._keys('acc')

for minion in sorted(keys - set(minions.keys())):
print minion
print(minion)


def up():
@@ -28,4 +28,4 @@ def up():
minions = client.cmd('*', 'test.ping', timeout=1)

for minion in sorted(minions):
print minion
print(minion)
@@ -19,9 +19,9 @@ def wollist(maclist, bcast='255.255.255.255', destport=9):
file = open(maclist, 'r')
for mac in file:
wol(mac.strip(), bcast, destport)
print "Waking up %s" % mac.strip()
print("Waking up %s" % mac.strip())
except Exception as inst:
print "Failed to open the MAC file. Error: %s" % inst
print("Failed to open the MAC file. Error: %s" % inst)

def wol(mac, bcast='255.255.255.255', destport=9):
'''
@@ -49,4 +49,4 @@ def wol(mac, bcast='255.255.255.255', destport=9):
('\\x' + mac[8:10]).decode('string_escape') + \
('\\x' + mac[10:12]).decode('string_escape')
s.sendto('\xff'*6 + dest*16, (bcast, int(destport)))
print "Sent magic packet to minion."
print("Sent magic packet to minion.")
@@ -117,7 +117,7 @@ def daemonize():
servicename = 'salt-minion'
try:
status = win32serviceutil.QueryServiceStatus(servicename)
except win32service.error, details:
except win32service.error as details:
if details[0]==winerror.ERROR_SERVICE_DOES_NOT_EXIST:
saltminionservice.instart(saltminionservice.MinionService, servicename, 'Salt Minion')
sys.exit(0)
@@ -141,7 +141,7 @@ def daemonize():
# decouple from parent environment
os.chdir("/")
os.setsid()
os.umask(022)
os.umask(0x022)

# do second fork
try:
@@ -559,7 +559,7 @@ def find(path, options):

if __name__ == '__main__':
if len(sys.argv) < 2:
print >> sys.stderr, "usage: {0} path [options]".format(sys.argv[0])
print("usage: {0} path [options]".format(sys.argv[0]), file=sys.stderr)
sys.exit(1)

path = sys.argv[1]
@@ -571,8 +571,8 @@ def find(path, options):
try:
f = Finder(criteria)
except ValueError, ex:
print >> sys.stderr, 'error: {0}'.format(ex)
print('error: {0}'.format(ex), file=sys.stderr)
sys.exit(1)

for result in f.find(path):
print result
print(result)
@@ -24,7 +24,7 @@ def stop(self):
servicename = 'salt-minion'
try:
status = win32serviceutil.QueryServiceStatus(servicename)
except win32service.error, details:
except win32service.error as details:
if details[0]==winerror.ERROR_SERVICE_DOES_NOT_EXIST:
instart(MinionService, servicename, 'Salt Minion')
sys.exit(0)
@@ -1,5 +1,4 @@
import codecs
from contextlib import nested # For < 2.7 compat
import os
import shutil
import difflib
@@ -8,7 +7,10 @@
import logging
import tempfile
import traceback
import urlparse
try:
import urlparse
except:
import urllib.parse as urlparse
import copy

logger = logging.getLogger(__name__)
@@ -71,7 +71,7 @@ def verify_env(dirs):
cumask = os.umask(63) # 077
os.makedirs(dir_)
os.umask(cumask)
except OSError, e:
except OSError as e:
sys.stderr.write('Failed to create directory path "{0}" - {1}\n'.format(dir_, e))

mode = os.stat(dir_)
@@ -29,7 +29,7 @@ def SvcDoRun(self):
self.log('wait')
win32event.WaitForSingleObject(self.stop_event, win32event.INFINITE)
self.log('done')
except Exception, x:
except Exception as x:
self.log('Exception : %s' % x)
self.SvcStop()
def SvcStop(self):
@@ -71,12 +71,12 @@ def instart(cls, name, display_name=None, stay_alive=True):
cls._svc_display_name_,
startType=win32service.SERVICE_AUTO_START
)
print 'Install ok'
print('Install ok')
win32serviceutil.StartService(
cls._svc_name_
)
print 'Start ok'
except Exception, x:
print str(x)
print('Start ok')
except Exception as x:
print(str(x))


@@ -39,7 +39,7 @@ def construct_mapping(self, node, deep=False):
key = self.construct_object(key_node, deep=deep)
try:
hash(key)
except TypeError, exc:
except TypeError as exc:
raise ConstructorError('while constructing a mapping', node.start_mark,
'found unacceptable key (%s)' % exc, key_node.start_mark)
value = self.construct_object(value_node, deep=deep)
@@ -20,26 +20,26 @@ def run_integration_tests(opts=None):
'''
if not opts:
opts = {}
print '~' * PNUM
print 'Setting up Salt daemons to execute tests'
print '~' * PNUM
print('~' * PNUM)
print('Setting up Salt daemons to execute tests')
print('~' * PNUM)
with TestDaemon():
if opts.get('module', True):
moduleloader = saltunittest.TestLoader()
moduletests = moduleloader.discover(
os.path.join(TEST_DIR, 'integration', 'modules'),
'*.py'
)
print '~' * PNUM
print 'Starting Module Tests'
print '~' * PNUM
print('~' * PNUM)
print('Starting Module Tests')
print('~' * PNUM)
saltunittest.TextTestRunner(verbosity=1).run(moduletests)
if opts.get('client', True):
clientloader = saltunittest.TestLoader()
clienttests = clientloader.discover(os.path.join(TEST_DIR, 'integration', 'client'), '*.py')
print '~' * PNUM
print 'Starting Client Tests'
print '~' * PNUM
print('~' * PNUM)
print('Starting Client Tests')
print('~' * PNUM)
saltunittest.TextTestRunner(verbosity=1).run(clienttests)


@@ -53,9 +53,9 @@ def run_unit_tests(opts=None):
return
loader = saltunittest.TestLoader()
tests = loader.discover(os.path.join(TEST_DIR, 'unit', 'templates'), '*.py')
print '~' * PNUM
print 'Starting Unit Tests'
print '~' * PNUM
print('~' * PNUM)
print('Starting Unit Tests')
print('~' * PNUM)
saltunittest.TextTestRunner(verbosity=1).run(tests)


@@ -92,13 +92,13 @@ def parse_opts():

opts = {}

for key, val in options.__dict__.items():
for key, val in list(options.__dict__.items()):
if val:
reverse = True
opts[key] = not val

if reverse:
for key, val in opts.items():
for key, val in list(opts.items()):
opts[key] = not opts[key]

return opts
@@ -18,7 +18,7 @@
TestCase, expectedFailure, \
TestSuite
except ImportError:
print "You need to install unittest2 to run the salt tests"
print("You need to install unittest2 to run the salt tests")
sys.exit(1)
else:
from unittest import TestLoader, TextTestRunner,\