Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos-caddy
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Guillaume Hervier
slapos-caddy
Commits
7985acb4
Commit
7985acb4
authored
Nov 13, 2012
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: extracted template arguments
parent
a9636aa1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
+21
-10
slapos/recipe/addresiliency/template/bully_new.py.in
slapos/recipe/addresiliency/template/bully_new.py.in
+21
-10
No files found.
slapos/recipe/addresiliency/template/bully_new.py.in
View file @
7985acb4
...
...
@@ -14,21 +14,32 @@ import slapos
port = 50000
arg_server_url = '%(server_url)s'
arg_key_file = '%(key_file)s'
arg_cert_file = '%(cert_file)s'
arg_computer_id = '%(computer_id)s'
arg_partition_id = '%(partition_id)s'
arg_software = '%(software)s'
arg_namebase = '%(namebase)s'
arg_confpath = '%(confpath)s'
def rename_broken_and_stop():
try:
slap = slapmodule.slap()
slap.initializeConnection(
'%(server_url)s'
,
'%(key_file)s'
,
'%(cert_file)s'
)
computer_partition = slap.registerComputerPartition(computer_guid=
'%(computer_id)s'
,
partition_id=
'%(partition_id)s'
)
broken = computer_partition.request(software_release=
'%(software)s'
,
slap.initializeConnection(
arg_server_url
,
arg_key_file
,
arg_cert_file
)
computer_partition = slap.registerComputerPartition(computer_guid=
arg_computer_id
,
partition_id=
arg_partition_id
)
broken = computer_partition.request(software_release=
arg_software
,
software_type='frozen',
partition_reference=
'%(namebase)s
0')
partition_reference=
arg_namebase+'
0')
broken.rename('broken-{}'.format(time.strftime("%%d-%%b_%%H:%%M:%%S", time.gmtime())))
broken.stopped()
computer_partition.rename(
'%(namebase)s
0')
computer_partition.rename(
arg_namebase+'
0')
print 'renaming done\n'
except slapos.slap.slap.ServerError:
print 'Internal server error\n'
...
...
@@ -55,7 +66,7 @@ class ResilientInstance(object):
def loadConnectionInfos(self):
file = open(
'%(confpath)s'
, 'r')
file = open(
arg_confpath
, 'r')
params = file.read().split('\n')
file.close()
self.nbComp = len([x.strip("' ") for x in params[0].strip('[],').split(',')])
...
...
@@ -181,7 +192,7 @@ class Wrapper(object):
self.socket = None
def getConnectionInfos(self):
file = open(
'%(confpath)s'
, 'r')
file = open(
arg_confpath
, 'r')
params = file.read().split('\n')
file.close()
self.ips = [x.strip("' ") for x in params[0].strip('[],').split(',')]
...
...
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