MCPcopy Create free account
hub / github.com/cloudgraphdev/cli / run

Method run

src/commands/policy/remove.ts:27–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25 static hidden = false
26
27 async run(): Promise<void> {
28 try {
29 const {
30 manager,
31 noSave = false,
32 plugins: pluginsRemoved = [],
33 } = await this.remove(PluginType.PolicyPack)
34
35 for (const key of pluginsRemoved) {
36 if (manager && !noSave) {
37 manager.removeFromLockFile(key)
38
39 const config = this.getCGConfig()
40 if (config) {
41 const configuredPolicies =
42 config.cloudGraph.plugins?.[PluginType.PolicyPack] || []
43
44 if (!isEmpty(configuredPolicies)) {
45 // Remove policy from Policy Pack Plugin array
46 config.cloudGraph.plugins[PluginType.PolicyPack] =
47 configuredPolicies.filter(
48 (p: ConfiguredPlugin) => p.name !== key
49 )
50
51 this.saveCloudGraphConfigFile(config)
52 }
53 }
54 }
55 }
56 } catch (error) {
57 this.logger.stopSpinner()
58 }
59 }
60}

Callers

nothing calls this directly

Calls 2

removeFromLockFileMethod · 0.80

Tested by

no test coverage detected