From 952c86dc31743260853724174156c1a5f9830878 Mon Sep 17 00:00:00 2001 From: scottydawg <923236+scottydawg@users.noreply.github.com> Date: Tue, 9 Aug 2022 10:28:22 -0400 Subject: [PATCH] fix: remove commented code from reconciler --- .../src/commands/reconcile/index.ts | 88 ++----------------- 1 file changed, 6 insertions(+), 82 deletions(-) diff --git a/packages/events-example/src/commands/reconcile/index.ts b/packages/events-example/src/commands/reconcile/index.ts index 7b707083..64ead172 100644 --- a/packages/events-example/src/commands/reconcile/index.ts +++ b/packages/events-example/src/commands/reconcile/index.ts @@ -1,14 +1,5 @@ -import { CliUx, Command, Flags } from '@oclif/core'; +import { Command, Flags } from '@oclif/core'; import Nile, { Instance, NileApi } from '@theniledev/js'; -import { - DestroyResult, - InlineProgramArgs, - LocalWorkspace, - StackSummary, - Stack, - UpResult, - PulumiFn, -} from '@pulumi/pulumi/automation'; import { pulumiProgramGenerator } from '../../pulumiS3'; import PulumiAwsDeployment from '../../deployments/pulumi'; @@ -39,70 +30,9 @@ export default class Reconcile extends Command { status: Flags.boolean({ char: 's', description: 'status', default: false }), }; - //localWorkspace!: LocalWorkspace; nile!: NileApi; deployment!: PulumiAwsDeployment; - /* - async waitOnStack(stack: Stack): Promise { - let stackInfo; - do { - stackInfo = await stack.info(); - this.debug(stackInfo); - } while (stackInfo != undefined && stackInfo?.result !== 'succeeded'); - } - - async getStack(stackName: string, program: PulumiFn): Promise { - const args: InlineProgramArgs = { - stackName, - projectName: 'tryhard', - program, - }; - const stack = await LocalWorkspace.createOrSelectStack(args); - await stack.setConfig('aws:region', { value: 'us-west-2' }); - return stack; - } - - async createStack(instance: Instance): Promise { - const stack = await this.getStack(instance.id, pulumiProgram(instance)); - await this.waitOnStack(stack); - try { - CliUx.ux.action.start(`Creating a stack id=${instance.id}`); - return await stack.up({ onOutput: console.log }); - } finally { - CliUx.ux.action.stop(); - } - } - - async destroyStack(id: string): Promise { - const stack = await this.getStack(id, pulumiProgram({})); - await this.waitOnStack(stack); - try { - CliUx.ux.action.start(`Destroying a stack id=${id}`); - return await stack.destroy({ onOutput: console.log }); - } finally { - CliUx.ux.action.stop(); - } - } - - async loadPulumiStacks(): Promise<{ [key: string]: StackSummary }> { - const stacks = await ( - await this.localWorkspace.listStacks() - ).reduce(async (accP, stack) => { - const acc = await accP; - const fullStack = await this.getStack(stack.name, pulumiProgram({})); - const info = await fullStack.info(); - if (info?.kind != 'destroy') { - acc[stack.name] = stack; - this.debug('adding stack', stack); - } - return acc; - }, Promise.resolve({} as { [key: string]: StackSummary })); - this.debug(stacks); - return stacks; - } - */ - async loadInstances( organization: string, entity: string @@ -127,17 +57,11 @@ export default class Reconcile extends Command { const { flags } = await this.parse(Reconcile); // pulumi setup - /* - this.localWorkspace = await LocalWorkspace.create({ - projectSettings: { name: flags.workspace, runtime: 'nodejs' }, - }); - this.localWorkspace.installPlugin('aws', 'v4.0.0'); - */ - this.deployment = await PulumiAwsDeployment.create( - "tryhard", - { projectSettings: { name: flags.workspace, runtime: 'nodejs' } }, - pulumiProgramGenerator - ) + this.deployment = await PulumiAwsDeployment.create( + "tryhard", + { projectSettings: { name: flags.workspace, runtime: 'nodejs' } }, + pulumiProgramGenerator + ) // nile setup this.nile = Nile({ basePath: flags.basePath, workspace: flags.workspace });