Commit 63f34da8 authored by Nicolas Wavrant's avatar Nicolas Wavrant

runner: sometimes only the available software releases are needed

For exemple we don't want to switch an instance to a software release
that is marked as to-be-deleted
parent 4dce829d
...@@ -122,15 +122,19 @@ def createNewUser(config, name, passwd): ...@@ -122,15 +122,19 @@ def createNewUser(config, name, passwd):
return False return False
return True return True
def _getSoftwareReleaseList(config):
def getAvailableSoftwareReleaseURIList(config):
slap = slapos.slap.slap() slap = slapos.slap.slap()
slap.initializeConnection(config['master_url']) slap.initializeConnection(config['master_url'])
return slap.registerComputer(config['computer_id']).getSoftwareReleaseList()
def getAvailableSoftwareReleaseURIList(config):
return [ return [
x.getURI() for x in \ x.getURI() for x in _getSoftwareReleaseList(config)
slap.registerComputer(config['computer_id']).getSoftwareReleaseList() if x._requested_state == "available"
] ]
def getAllSoftwareReleaseURIList(config):
return [x.getURI() for x in _getSoftwareReleaseList(config)]
def getCurrentSoftwareReleaseProfile(config): def getCurrentSoftwareReleaseProfile(config):
""" """
...@@ -219,7 +223,7 @@ def supplySoftwareRelease(config, sr_path): ...@@ -219,7 +223,7 @@ def supplySoftwareRelease(config, sr_path):
setCurrentSoftwareRelease(config, sr_path) setCurrentSoftwareRelease(config, sr_path)
def destroySoftwareRelease(config, uri): def destroySoftwareRelease(config, uri):
available_sr_list = getAvailableSoftwareReleaseURIList(config) available_sr_list = getAllSoftwareReleaseURIList(config)
for available_sr in available_sr_list: for available_sr in available_sr_list:
if os.path.realpath(available_sr) == os.path.realpath(uri): if os.path.realpath(available_sr) == os.path.realpath(uri):
real_uri = available_sr real_uri = available_sr
...@@ -928,7 +932,7 @@ def isSoftwareReleaseCompleted(config, software_release_uri): ...@@ -928,7 +932,7 @@ def isSoftwareReleaseCompleted(config, software_release_uri):
def areAllSoftwareReleaseCompleted(config): def areAllSoftwareReleaseCompleted(config):
result_list = [] result_list = []
for software_release_uri in self.getAvailableSoftwareReleaseURIList(config): for software_release_uri in getAvailableSoftwareReleaseURIList(config):
result_list.append(isSoftwareReleaseReady(config, software_release_uri)) result_list.append(isSoftwareReleaseReady(config, software_release_uri))
return all(result_list) return all(result_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