Skip to content

Commit

Permalink
Fixing issue where edit cloud was breaking view when OLVM environment…
Browse files Browse the repository at this point in the history
… is completely down
  • Loading branch information
jsaardchithpe committed Dec 3, 2024
1 parent 0b41c2e commit c6c42da
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=1.0.1
version=1.0.2
karmanVersion=2.3.0
morpheusApiVersion=1.1.6
morpheusPluginGradleVersion=1.0.6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,13 @@ class OlvmOptionSourceProvider extends AbstractOptionSourceProvider {
def rtn
if(cloud?.accountCredentialData?.username && cloud?.accountCredentialData?.password) {
def connection = OlvmComputeUtility.getToken(cloud)
def dcResult = OlvmComputeUtility.listDatacenters([connection:connection])
if (dcResult.success && dcResult.data.datacenters) {
rtn = [[name: morpheusContext.services.localization.get('gomorpheus.label.all'), value: 'all']]
for (dc in dcResult.data.datacenters) {
rtn << [name:dc.name, value:dc.id]
if (!connection.error) {
def dcResult = OlvmComputeUtility.listDatacenters([connection: connection])
if (dcResult.success && dcResult.data.datacenters) {
rtn = [[name: morpheusContext.services.localization.get('gomorpheus.label.all'), value: 'all']]
for (dc in dcResult.data.datacenters) {
rtn << [name: dc.name, value: dc.id]
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1909,11 +1909,15 @@ class OlvmComputeUtility {
)

if (resp.success) {
return [apiUrl: extractRootURL(config.endpointUrl), token: resp.data['access_token']]
return [success:true, apiUrl: extractRootURL(config.endpointUrl), token: resp.data['access_token']]
} else {
throw new RuntimeException("Failed to authenticate to OLVM environment: ${extractErrorMessage(resp.data)}")
log.error("Failed to authenticate to OLVM environment: ${extractErrorMessage(resp.data)}")
return [success:false, apiUrl: extractRootURL(config.endpointUrl), error:extractErrorMessage(resp.data)]
}
}
catch (Throwable t) {
return [success:false, apiUrl: extractRootURL(config.endpointUrl), error:t.message]
}
finally {
client?.shutdownClient()
}
Expand Down

0 comments on commit c6c42da

Please sign in to comment.