Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Roque
slapos
Commits
a28bfd61
Commit
a28bfd61
authored
12 years ago
by
Marco Mariani
Browse files
Options
Download
Email Patches
Plain Diff
replace unescaped % with .format()
parent
4e49e0c3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
slapos/recipe/addresiliency/template/bully_new.py.in
slapos/recipe/addresiliency/template/bully_new.py.in
+6
-6
No files found.
slapos/recipe/addresiliency/template/bully_new.py.in
View file @
a28bfd61
...
...
@@ -26,7 +26,7 @@ def rename_broken_and_stop():
software_type='frozen',
partition_reference='%(namebase)s0')
broken.rename('broken-
%%s' %%
(time.strftime("%%d-%%b_%%H:%%M:%%S", time.gmtime())))
broken.rename('broken-
{}'.format
(time.strftime("%%d-%%b_%%H:%%M:%%S", time.gmtime())))
broken.stopped()
computer_partition.rename('%(namebase)s0')
print 'renaming done\n'
...
...
@@ -94,7 +94,7 @@ class ResilientInstance(object):
elif message == 'victory':
if int(sender) == int(self.halter) and self.state == 'waitingConfirm':
print '
%s
thinks
%s
is the leader\n'
%
(self.id, sender)
print '
{}
thinks
{}
is the leader\n'
.format
(self.id, sender)
self.comm.send('ok', sender)
self.state = 'normal'
...
...
@@ -106,7 +106,7 @@ class ResilientInstance(object):
self.comm.send('ping', higher)
message, sender = self.okCanal.get()
if message:
#print '
%s
is alive (
%s
)\n'
%
(higher, self.id)
#print '
{}
is alive (
{}
)\n'
.format
(higher, self.id)
self.inElection = False
return False
continue
...
...
@@ -115,7 +115,7 @@ class ResilientInstance(object):
return False
#I should be the new coordinator, halt those below me
print 'Should be ME :
%s
\n'
%
self.id
print 'Should be ME :
{}
\n'
.format(
self.id
)
self.state = 'election'
self.halter = self.id
ups = []
...
...
@@ -136,7 +136,7 @@ class ResilientInstance(object):
return self.election()
self.state = 'normal'
self.active = True
print '
%s
Is THE LEADER \n'
%
self.id
print '
{}
Is THE LEADER \n'
.format(
self.id
)
rename_broken_and_stop()
...
...
@@ -202,7 +202,7 @@ class Wrapper(object):
try:
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s.connect((self.ips[number], port + number))
s.send(message + ('
%s
\n'
%
self.id))
s.send(message + ('
{}
\n'
.format(
self.id))
)
except (socket.error, socket.herror, socket.gaierror, socket.timeout):
pass
finally:
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment