Fix sting formatting

This commit is contained in:
Bret Palsson 2012-07-29 23:30:31 -06:00
parent 0195b360a1
commit 9e39331ff9

View File

@ -270,7 +270,7 @@ class ReqServer(object):
self.master_key = mkey
self.context = zmq.Context(self.opts['worker_threads'])
# Prepare the zeromq sockets
self.uri = 'tcp://%(interface)s:%(ret_port)s' % self.opts
self.uri = 'tcp://{interface}:{ret_port}'.format(**self.opts)
self.clients = self.context.socket(zmq.ROUTER)
self.workers = self.context.socket(zmq.DEALER)
self.w_uri = 'ipc://{0}'.format(
@ -395,14 +395,14 @@ class MWorker(multiprocessing.Process):
'''
Take care of a cleartext command
'''
log.info('Clear payload received with command %(cmd)s', load)
log.info('Clear payload received with command {cmd}'.format(**load))
return getattr(self.clear_funcs, load['cmd'])(load)
def _handle_pub(self, load):
'''
Handle a command sent via a public key pair
'''
log.info('Pubkey payload received with command %(cmd)s', load)
log.info('Pubkey payload received with command {cmd}'.format(**load))
def _handle_aes(self, load):
'''
@ -673,7 +673,7 @@ class AESFuncs(object):
if not os.path.isdir(jid_dir):
log.error(
'An inconsistency occurred, a job was received with a job id '
'that is not present on the master: %(jid)s', load
'that is not present on the master: {jid}'.format(**load)
)
return False
hn_dir = os.path.join(jid_dir, load['id'])
@ -711,7 +711,7 @@ class AESFuncs(object):
if not os.path.isdir(jid_dir):
log.error(
'An inconsistency occurred, a job was received with a job id '
'that is not present on the master: %(jid)s', load
'that is not present on the master: {jid}'.format(**load)
)
return False
wtag = os.path.join(jid_dir, 'wtag_{0}'.format(load['id']))
@ -978,7 +978,7 @@ class ClearFuncs(object):
0,
'list'
)
log.debug('Cluster distributed: %s', ret)
log.debug('Cluster distributed: {0}'.format(ret))
def _cluster_load(self):
'''
@ -1101,7 +1101,7 @@ class ClearFuncs(object):
# 3. make an rsa key with the pub key
# 4. encrypt the aes key as an encrypted salt.payload
# 5. package the return and return it
log.info('Authentication request from %(id)s', load)
log.info('Authentication request from {id}'.format(**load))
pubfn = os.path.join(self.opts['pki_dir'],
'minions',
load['id'])
@ -1119,9 +1119,9 @@ class ClearFuncs(object):
# The key has been accepted check it
if not open(pubfn, 'r').read() == load['pub']:
log.error(
'Authentication attempt from %(id)s failed, the public '
'Authentication attempt from {id} failed, the public '
'keys did not match. This may be an attempt to compromise '
'the Salt cluster.', load
'the Salt cluster.'.format(**load)
)
ret = {'enc': 'clear',
'load': {'ret': False}}
@ -1132,7 +1132,7 @@ class ClearFuncs(object):
return ret
elif os.path.isfile(pubfn_rejected):
# The key has been rejected, don't place it in pending
log.info('Public key rejected for %(id)s', load)
log.info('Public key rejected for {id}'.format(**load))
ret = {'enc': 'clear',
'load': {'ret': False}}
eload = {'result': False,
@ -1143,7 +1143,7 @@ class ClearFuncs(object):
elif not os.path.isfile(pubfn_pend)\
and not self._check_autosign(load['id']):
# This is a new key, stick it in pre
log.info('New public key placed in pending for %(id)s', load)
log.info('New public key placed in pending for {id}'.format(**load))
with open(pubfn_pend, 'w+') as fp_:
fp_.write(load['pub'])
ret = {'enc': 'clear',
@ -1160,9 +1160,9 @@ class ClearFuncs(object):
# ret False
if not open(pubfn_pend, 'r').read() == load['pub']:
log.error(
'Authentication attempt from %(id)s failed, the public '
'Authentication attempt from {id} failed, the public '
'keys in pending did not match. This may be an attempt to '
'compromise the Salt cluster.', load
'compromise the Salt cluster.'.format(**load)
)
eload = {'result': False,
'id': load['id'],
@ -1172,9 +1172,8 @@ class ClearFuncs(object):
'load': {'ret': False}}
else:
log.info(
'Authentication failed from host %(id)s, the key is in '
'pending and needs to be accepted with salt-key -a %(id)s',
load
'Authentication failed from host {id}, the key is in '
'pending and needs to be accepted with salt-key -a {id}'.format(**load)
)
eload = {'result': True,
'act': 'pend',
@ -1188,9 +1187,9 @@ class ClearFuncs(object):
# This key is in pending, if it is the same key auto accept it
if not open(pubfn_pend, 'r').read() == load['pub']:
log.error(
'Authentication attempt from %(id)s failed, the public '
'Authentication attempt from {id} failed, the public '
'keys in pending did not match. This may be an attempt to '
'compromise the Salt cluster.', load
'compromise the Salt cluster.'.format(**load)
)
eload = {'result': False,
'id': load['id'],
@ -1214,7 +1213,7 @@ class ClearFuncs(object):
return {'enc': 'clear',
'load': {'ret': False}}
log.info('Authentication accepted from %(id)s', load)
log.info('Authentication accepted from {id}'.format(**load))
with open(pubfn, 'w+') as fp_:
fp_.write(load['pub'])
pub = None