From fd9eec1e69501b461ba47b4e0f25f295805355ba Mon Sep 17 00:00:00 2001 From: Jeff Lu Date: Mon, 29 Nov 2021 19:36:15 -0500 Subject: [PATCH] add filter --- build/commands/deploy.js | 7 ++++--- build/commands/deploy.js.map | 2 +- src/commands/deploy.ts | 7 ++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/build/commands/deploy.js b/build/commands/deploy.js index 525a3ce..0b66776 100755 --- a/build/commands/deploy.js +++ b/build/commands/deploy.js @@ -44,8 +44,8 @@ const handler = (argv) => { const p = pattern || ''; const configPath = config_path || hzn_1.utils.getHznConfig(); const skipInitialize = ['uninstallHorizon']; - const justRun = ['removeOrg']; - const promptForUpdate = ['setup', 'publishService', 'publishPatterrn', 'publishMMSService', 'publishMMSPattern', 'registerAgent', 'publishMMSObject', 'unregisterAgent']; + const justRun = ['buildMMSImage', 'buildServiceImage', 'checkConfigState', 'createHznKey', 'dockerImageExists', 'getDeviceArch', 'listDeploymentPolicy', 'listNode', 'listNodePattern', 'listObject', 'listPattern', 'listService', 'removeOrg', 'showHznInfo', 'uninstallHorizon', 'updateHznInfo']; + const promptForUpdate = ['setup', 'test', 'publishService', 'publishPatterrn', 'publishMMSService', 'publishMMSPattern', 'registerAgent', 'publishMMSObject', 'unregisterAgent']; console.log('$$$ ', action, env, configPath, n); const proceed = () => { if ((0, fs_1.existsSync)(`${hzn_1.utils.getHznConfig()}/.env-hzn.json`)) { @@ -75,7 +75,8 @@ const handler = (argv) => { .subscribe({ complete: () => { if (justRun.indexOf(action) >= 0) { - hzn_1.utils.removeOrg(env) + const hzn = new hzn_1.Hzn(env, configPath, n, objType, objId, obj, p); + hzn[action](env) .subscribe({ complete: () => process.exit(0), error: (err) => { diff --git a/build/commands/deploy.js.map b/build/commands/deploy.js.map index 4510bf0..bb80db7 100644 --- a/build/commands/deploy.js.map +++ b/build/commands/deploy.js.map @@ -1 +1 @@ -{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"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AC,GAAG,CAAC,GAAG,CAAC,CAAC;wBACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;oBAClB,CAAC;iBACF,CAAC,CAAA;aACH;iBAAM;gBACL,WAAK,CAAC,cAAc,CAAC,GAAG,CAAC;qBACxB,SAAS,CAAC;oBACT,QAAQ,EAAE,GAAG,EAAE;wBACb,OAAO,EAAE,CAAA;oBACX,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;wBAChB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;wBAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;oBAClB,CAAC;iBACF,CAAC,CAAA;aACH;QACH,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;YAChB,IAAG,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;gBACrC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAA;gBACnC,WAAK,CAAC,aAAa,CAAC,GAAG,CAAC;qBACvB,SAAS,CAAC;oBACT,QAAQ,EAAE,GAAG,EAAE;wBACb,OAAO,EAAE,CAAC;oBACZ,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;iBAChC,CAAC,CAAA;aACH;iBAAM;gBACL,WAAK,CAAC,gBAAgB,EAAE;qBACvB,SAAS,CAAC;oBACT,QAAQ,EAAC,GAAG,EAAE;wBACZ,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;wBAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;oBACjB,CAAC;iBACF,CAAC,CAAA;aACH;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAC;AAjGW,QAAA,OAAO,WAiGlB"} \ No newline at end of file +{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":";;;;;;AACA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AQ,EAAC,GAAG,EAAE;wBACZ,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;wBAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;oBACjB,CAAC;iBACF,CAAC,CAAA;aACH;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAC;AAlGW,QAAA,OAAO,WAkGlB"} \ No newline at end of file diff --git a/src/commands/deploy.ts b/src/commands/deploy.ts index dcc2798..b0e45c6 100644 --- a/src/commands/deploy.ts +++ b/src/commands/deploy.ts @@ -57,8 +57,8 @@ export const handler = (argv: Arguments): void => { const p = pattern || ''; const configPath = config_path || utils.getHznConfig(); const skipInitialize = ['uninstallHorizon']; - const justRun = ['buildMMSImage', 'buildServiceImage', 'checkConfigState', 'createHznKey', 'dockerImageExists', 'getDeviceArch', 'listDeploymentPolicy', 'listNode', 'listNodePattern', 'listObject', 'listPattern', 'listService', 'removeOrg', 'showHznInfo', 'uninstallHorizon', 'unregisterAgent', 'updateHznInfo']; - const promptForUpdate = ['setup', 'publishService', 'publishPatterrn', 'publishMMSService', 'publishMMSPattern', 'registerAgent', 'publishMMSObject', 'unregisterAgent'] + const justRun = ['buildMMSImage', 'buildServiceImage', 'checkConfigState', 'createHznKey', 'dockerImageExists', 'getDeviceArch', 'listDeploymentPolicy', 'listNode', 'listNodePattern', 'listObject', 'listPattern', 'listService', 'removeOrg', 'showHznInfo', 'uninstallHorizon', 'updateHznInfo']; + const promptForUpdate = ['setup', 'test', 'publishService', 'publishPatterrn', 'publishMMSService', 'publishMMSPattern', 'registerAgent', 'publishMMSObject', 'unregisterAgent'] console.log('$$$ ', action, env, configPath, n); const proceed = () => { @@ -90,7 +90,8 @@ export const handler = (argv: Arguments): void => { .subscribe({ complete: () => { if(justRun.indexOf(action) >= 0) { - utils.removeOrg(env) + const hzn = new Hzn(env, configPath, n, objType, objId, obj, p); + hzn[action](env) .subscribe({ complete: () => process.exit(0), error: (err) => {