@@ -19,7 +19,6 @@ package plugins
1919import (
2020 "context"
2121 "encoding/json"
22- "errors"
2322 "fmt"
2423 "log/slog"
2524 "os"
@@ -519,29 +518,10 @@ func (pc *PluginsCommand) InstallPlugin(ctx context.Context, pluginName, version
519518}
520519
521520func (pc * PluginsCommand ) installPlugin (ctx context.Context , pluginName string , version * semver.Version , useMajor int ) error {
522- // to check we can create directories here
523- // we try to create root plugins folder
524- err := os .MkdirAll (flags .DeckhousePluginsDir + "/plugins" , 0755 )
525- // if permission failed
526- if errors .Is (err , os .ErrPermission ) {
527- pc .logger .Warn ("use homedir instead of default d8 plugins path in '/opt/deckhouse/lib/deckhouse-cli'" , slog .String ("new_path" , flags .DeckhousePluginsDir ), dkplog .Err (err ))
528-
529- flags .DeckhousePluginsDir , err = os .UserHomeDir ()
530- if err != nil {
531- return fmt .Errorf ("failed to receive home dir to create plugins dir: %w" , err )
532- }
533-
534- flags .DeckhousePluginsDir = path .Join (flags .DeckhousePluginsDir , ".deckhouse-cli" )
535- }
536-
537- if err != nil {
538- return fmt .Errorf ("failed to create plugin root directory: %w" , err )
539- }
540-
541521 // create plugin directory if it doesn't exist
542522 // example path: /opt/deckhouse/lib/deckhouse-cli/plugins/example-plugin
543523 pluginDir := path .Join (flags .DeckhousePluginsDir , "plugins" , pluginName )
544- err = os .MkdirAll (pluginDir , 0755 )
524+ err : = os .MkdirAll (pluginDir , 0755 )
545525 if err != nil {
546526 return fmt .Errorf ("failed to create plugin directory: %w" , err )
547527 }
0 commit comments