Commit 9a2cae4e authored by Nicolas Wavrant's avatar Nicolas Wavrant

runner: only list correctly built software releases

in the field listing the software releases available for the instance.
parent 41412fa4
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
<h2 class='title'>Software Release of main instance</h2> <h2 class='title'>Software Release of main instance</h2>
<select style="margin-top:5px;" name="software_release", id="software_release"> <select style="margin-top:5px;" name="software_release", id="software_release">
<option value="{{ current_software_release_uri }}">{{ current_software_release_uri }}</option> <option value="{{ current_software_release_uri }}">{{ current_software_release_uri }}</option>
{% for sr_uri in software_release_uri_list %} {% for sr_uri in built_available_sr_list %}
<option value="{{ sr_uri }}">{{ sr_uri }}</option> <option value="{{ sr_uri }}">{{ sr_uri }}</option>
{% endfor %} {% endfor %}
</select> </select>
......
...@@ -895,18 +895,18 @@ def readParameters(path): ...@@ -895,18 +895,18 @@ def readParameters(path):
else: else:
return "No such file or directory: %s" % path return "No such file or directory: %s" % path
def isSoftwareReleaseCompleted(config, software_release_uri):
software_release_path = os.path.join(
config['software_root'],
md5digest(software_release_uri)
)
return os.path.exists(os.path.join(software_release_path, '.completed'))
def areAllSoftwareReleaseCompleted(config): def areAllSoftwareReleaseCompleted(config):
result_list = [] result_list = []
for software_release_uri in self.getAvailableSoftwareReleaseURIList(config): for software_release_uri in self.getAvailableSoftwareReleaseURIList(config):
software_release_path = os.path.join( result_list.append(isSoftwareReleaseReady(config, software_release_uri))
config['software_root'], return all(result_list)
md5digest(software_release_uri)
)
if os.path.exists(os.path.join(software_release_path, '.completed')):
result_list.append(True)
else:
resultd_list.append(False)
return all(result_list)
def isSoftwareReleaseReady(config): def isSoftwareReleaseReady(config):
"""Return 1 if the Software Release has """Return 1 if the Software Release has
......
...@@ -185,9 +185,19 @@ def inspectInstance(): ...@@ -185,9 +185,19 @@ def inspectInstance():
file_path = '' file_path = ''
supervisor = [] supervisor = []
current_sr = utils.relativepath(app.config, utils.getCurrentSoftwareReleaseProfile(app.config)) current_sr = utils.relativepath(app.config, utils.getCurrentSoftwareReleaseProfile(app.config))
available_sr_list = [utils.relativepath(app.config, x) for x in utils.getAvailableSoftwareReleaseURIList(app.config)] available_sr_uri_list = utils.getAvailableSoftwareReleaseURIList(app.config)
available_sr_list = [
utils.relativepath(app.config, x)
for x in available_sr_uri_list
]
built_available_sr_list = [
utils.relativepath(app.config, x)
for x in available_sr_uri_list
if utils.isSoftwareReleaseCompleted(app.config, x)
]
if current_sr in available_sr_list: if current_sr in available_sr_list:
available_sr_list.remove(current_sr) available_sr_list.remove(current_sr)
built_available_sr_list.remove(current_sr)
if "application/json" in request.accept_mimetypes.best: if "application/json" in request.accept_mimetypes.best:
result_list = [] result_list = []
for service in supervisor: for service in supervisor:
...@@ -203,6 +213,7 @@ def inspectInstance(): ...@@ -203,6 +213,7 @@ def inspectInstance():
slap_status=getSlapStatus(app.config), slap_status=getSlapStatus(app.config),
partition_amount=app.config['partition_amount'], partition_amount=app.config['partition_amount'],
current_software_release_uri=current_sr, current_software_release_uri=current_sr,
built_available_sr_list=built_available_sr_list,
software_release_uri_list=available_sr_list software_release_uri_list=available_sr_list
) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment