Revert bulk config ops in nodejs auto-api (#6051)

This commit is contained in:
Komal 2021-01-04 14:38:55 -08:00 committed by GitHub
parent 21de78291f
commit 1ef22c375d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 15 deletions

View file

@ -5,9 +5,6 @@ CHANGELOG
- Allow `serializeFunction` to capture secrets.
[#6013](https://github.com/pulumi/pulumi/pull/6013)
- Parallelize bulk operations in NodeJS Automation API.
[#6022](https://github.com/pulumi/pulumi/pull/6022)
- [CLI] Allow `pulumi console` to accept a stack name
[#6031](https://github.com/pulumi/pulumi/pull/6031)

View file

@ -382,11 +382,10 @@ export class LocalWorkspace implements Workspace {
* @param config The `ConfigMap` to upsert against the existing config.
*/
async setAllConfig(stackName: string, config: ConfigMap): Promise<void> {
const configAdds: Promise<void>[] = [];
// TODO: do this in parallel after this is fixed https://github.com/pulumi/pulumi/issues/6050
for (const [key, value] of Object.entries(config)) {
configAdds.push(this.setConfig(stackName, key, value));
await this.setConfig(stackName, key, value);
}
await Promise.all(configAdds);
}
/**
* Removes the specified key-value pair on the provided stack name.
@ -408,11 +407,10 @@ export class LocalWorkspace implements Workspace {
* @param keys The list of keys to remove from the underlying config
*/
async removeAllConfig(stackName: string, keys: string[]): Promise<void> {
const configRemoves: Promise<void>[] = [];
// TODO: do this in parallel after this is fixed https://github.com/pulumi/pulumi/issues/6050
for (const key of keys) {
configRemoves.push(this.removeConfig(stackName, key));
await this.removeConfig(stackName, key);
}
await Promise.all(configRemoves);
}
/**
* Gets and sets the config map used with the last update for Stack matching stack name.

View file

@ -173,8 +173,9 @@ export class Stack {
args.push("--exec-kind", kind);
const upResult = await this.runPulumiCmd(args, opts?.onOutput);
onExit(upResult.code);
const [outputs, summary] = await Promise.all([this.outputs(), this.info()]);
// TODO: do this in parallel after this is fixed https://github.com/pulumi/pulumi/issues/6050
const outputs = await this.outputs();
const summary = await this.info();
return {
stdout: upResult.stdout,
stderr: upResult.stderr,
@ -386,10 +387,9 @@ export class Stack {
*/
async outputs(): Promise<OutputMap> {
await this.workspace.selectStack(this.name);
const [maskedResult, plaintextResult] = await Promise.all([
this.runPulumiCmd(["stack", "output", "--json"]),
this.runPulumiCmd(["stack", "output", "--json", "--show-secrets"]),
]);
// TODO: do this in parallel after this is fixed https://github.com/pulumi/pulumi/issues/6050
const maskedResult = await this.runPulumiCmd(["stack", "output", "--json"]);
const plaintextResult = await this.runPulumiCmd(["stack", "output", "--json", "--show-secrets"]);
const maskedOuts = JSON.parse(maskedResult.stdout);
const plaintextOuts = JSON.parse(plaintextResult.stdout);
const outputs: OutputMap = {};