Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aurel
slapos
Commits
a28bfd61
Commit
a28bfd61
authored
Nov 09, 2012
by
Marco Mariani
Browse files
Options
Browse Files
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():
...
@@ -26,7 +26,7 @@ def rename_broken_and_stop():
software_type='frozen',
software_type='frozen',
partition_reference='%(namebase)s0')
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()
broken.stopped()
computer_partition.rename('%(namebase)s0')
computer_partition.rename('%(namebase)s0')
print 'renaming done\n'
print 'renaming done\n'
...
@@ -94,7 +94,7 @@ class ResilientInstance(object):
...
@@ -94,7 +94,7 @@ class ResilientInstance(object):
elif message == 'victory':
elif message == 'victory':
if int(sender) == int(self.halter) and self.state == 'waitingConfirm':
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.comm.send('ok', sender)
self.state = 'normal'
self.state = 'normal'
...
@@ -106,7 +106,7 @@ class ResilientInstance(object):
...
@@ -106,7 +106,7 @@ class ResilientInstance(object):
self.comm.send('ping', higher)
self.comm.send('ping', higher)
message, sender = self.okCanal.get()
message, sender = self.okCanal.get()
if message:
if message:
#print '
%s is alive (%s)\n' %
(higher, self.id)
#print '
{} is alive ({})\n'.format
(higher, self.id)
self.inElection = False
self.inElection = False
return False
return False
continue
continue
...
@@ -115,7 +115,7 @@ class ResilientInstance(object):
...
@@ -115,7 +115,7 @@ class ResilientInstance(object):
return False
return False
#I should be the new coordinator, halt those below me
#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.state = 'election'
self.halter = self.id
self.halter = self.id
ups = []
ups = []
...
@@ -136,7 +136,7 @@ class ResilientInstance(object):
...
@@ -136,7 +136,7 @@ class ResilientInstance(object):
return self.election()
return self.election()
self.state = 'normal'
self.state = 'normal'
self.active = True
self.active = True
print '
%s Is THE LEADER \n' % self.id
print '
{} Is THE LEADER \n'.format(self.id)
rename_broken_and_stop()
rename_broken_and_stop()
...
@@ -202,7 +202,7 @@ class Wrapper(object):
...
@@ -202,7 +202,7 @@ class Wrapper(object):
try:
try:
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s.connect((self.ips[number], port + number))
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):
except (socket.error, socket.herror, socket.gaierror, socket.timeout):
pass
pass
finally:
finally:
...
...
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