Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
Remove post_install_hook files from cluster,package plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Anuj Chaudhari <anujc@vmware.com>
  • Loading branch information
anujc25 committed Oct 18, 2022
1 parent 4de3e3d commit 1aecc07
Showing 5 changed files with 22 additions and 34 deletions.
11 changes: 9 additions & 2 deletions cli/core/pkg/command/config.go
Original file line number Diff line number Diff line change
@@ -217,12 +217,18 @@ var initConfigCmd = &cobra.Command{
cfg.ClientOptions.CLI = &configapi.CLIOptions{}
}

descriptors, err := pluginmanager.InstalledPluginsDescriptors()
serverName := ""
server, err := cfg.GetCurrentServer()
if err == nil && server != nil {
serverName = server.Name
}

serverPluginDescriptors, standalonePluginDescriptors, err := pluginmanager.InstalledPlugins(serverName)
if err != nil {
return err
}

for _, desc := range descriptors {
for _, desc := range append(serverPluginDescriptors, standalonePluginDescriptors...) {
config.AddDefaultFeatureFlagsIfMissing(cfg, desc.DefaultFeatureFlags)
}

@@ -231,6 +237,7 @@ var initConfigCmd = &cobra.Command{
return err
}

log.Success("successfully initialized the config")
return nil
},
}
12 changes: 6 additions & 6 deletions cli/core/pkg/config/features_test.go
Original file line number Diff line number Diff line change
@@ -171,12 +171,12 @@ func TestConfigFeaturesDefaultsAdded(t *testing.T) {
},
}

added := addDefaultFeatureFlagsIfMissing(cfg, defaultFeatureFlags)
require.True(t, added, "addDefaultFeatureFlagsIfMissing should have added missing default values")
require.Equal(t, cfg.ClientOptions.Features["existing"]["truthy"], "false", "addDefaultFeatureFlagsIfMissing should have left existing FALSE value for truthy")
require.Equal(t, cfg.ClientOptions.Features["existing"]["falsey"], "true", "addDefaultFeatureFlagsIfMissing should have left existing TRUE value for falsey")
require.Equal(t, cfg.ClientOptions.Features["global"]["truthy"], "true", "addDefaultFeatureFlagsIfMissing should have added global TRUE value for truthy")
require.Equal(t, cfg.ClientOptions.Features["global"]["falsey"], "false", "addDefaultFeatureFlagsIfMissing should have added global FALSE value for falsey")
added := AddDefaultFeatureFlagsIfMissing(cfg, defaultFeatureFlags)
require.True(t, added, "AddDefaultFeatureFlagsIfMissing should have added missing default values")
require.Equal(t, cfg.ClientOptions.Features["existing"]["truthy"], "false", "AddDefaultFeatureFlagsIfMissing should have left existing FALSE value for truthy")
require.Equal(t, cfg.ClientOptions.Features["existing"]["falsey"], "true", "AddDefaultFeatureFlagsIfMissing should have left existing TRUE value for falsey")
require.Equal(t, cfg.ClientOptions.Features["global"]["truthy"], "true", "AddDefaultFeatureFlagsIfMissing should have added global TRUE value for truthy")
require.Equal(t, cfg.ClientOptions.Features["global"]["falsey"], "false", "AddDefaultFeatureFlagsIfMissing should have added global FALSE value for falsey")
}

func TestConfigFeaturesDefaultsNoneAdded(t *testing.T) {
7 changes: 7 additions & 0 deletions cli/runtime/apis/cli/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions cmd/cli/plugin/cluster/post_install_hook.go

This file was deleted.

13 changes: 0 additions & 13 deletions cmd/cli/plugin/package/post_install_hook.go

This file was deleted.

0 comments on commit 1aecc07

Please # to comment.