in internal/ssm/install.go [167:203]
func Uninstall(ctx context.Context, opts UninstallOptions) error {
opts.Logger.Info("Uninstalling SSM agent...")
actions := []func() error{
func() error {
return Deregister(ctx, opts.SSMRegistration, opts.SSMClient, opts.Logger)
},
func() error {
return removeFileOrDir(opts.SSMRegistration.RegistrationFilePath(), "uninstalling ssm registration file")
},
func() error {
return uninstallPreRegisterComponents(ctx, opts.PkgSource)
},
func() error {
return removeFileOrDir(filepath.Join(opts.InstallRoot, configRoot), "uninstalling ssm config files")
},
func() error {
return removeFileOrDir(filepath.Join(opts.InstallRoot, symlinkedAWSConfigPath), "uninstalling ssm aws config symlink")
},
func() error {
return removeFileOrDir(filepath.Join(opts.InstallRoot, defaultAWSConfigPath), "uninstalling ssm aws config")
},
}
allErrors := []error{}
for _, action := range actions {
if err := action(); err != nil {
allErrors = append(allErrors, err)
}
}
if len(allErrors) > 0 {
return stdErrors.Join(allErrors...)
}
return nil
}