Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #48 - Support 'Run Action' against vRO 7.6 and vRO 8 #58

Merged
merged 1 commit into from
Jan 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions common/src/rest/VroRestClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2018-2019 VMware, Inc.
* Copyright 2018-2020 VMware, Inc.
* SPDX-License-Identifier: MIT
*/

Expand Down Expand Up @@ -156,7 +156,7 @@ export class VroRestClient {
return execToken
}

async getWorkflowLogs(
async getWorkflowLogsPre76(
workflowId: string,
executionId: string,
severity: string,
Expand Down Expand Up @@ -199,6 +199,41 @@ export class VroRestClient {
return messages
}

async getWorkflowLogsPost76(
workflowId: string,
executionId: string,
severity: string,
timestamp: number
): Promise<LogMessage[]> {
const response: WorkflowLogsResponse = await this.send(
"GET",
`workflows/${workflowId}/executions/${executionId}/syslogs` +
`?conditions=severity=${severity}` +
`&conditions=timestamp${encodeURIComponent(">")}${timestamp}` +
"&conditions=type=system"
)

const messages: LogMessage[] = []

for (const log of response.logs) {
const e = log.entry
const description = e["long-description"] ? e["long-description"] : e["short-description"]
if (description.indexOf("*** End of execution stack.") > 0 ||
description.startsWith("__item_stack:/")
) {
continue
}

messages.push({
timestamp: e["time-stamp"],
severity: e.severity,
description
})
}

return messages
}

async importPackage(path: string): Promise<void> {
return this.send("POST", "content/packages?overwrite=true", {
formData: {
Expand Down
1 change: 1 addition & 0 deletions common/src/rest/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface WorkflowLogsResponse {
"time-stamp": string
"short-description": string
"long-description": string
"time-stamp-val": number
}
}[]
}
Expand Down
Loading