repo: Fix message while removing repo

Currently, `mixer repo remove` displays incorrect messages if repo does
not exist.

This fix displays the correct message.

Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
This commit is contained in:
Reagan Lopez
2019-12-13 15:29:03 -08:00
parent f63e6e2752
commit 62423866b0
3 changed files with 9 additions and 4 deletions
+9 -2
View File
@@ -287,11 +287,18 @@ func (b *Builder) RemoveRepo(name string) error {
_, err = DNFConf.GetSection(name)
if err != nil {
fmt.Printf("Repo %s does not exist.\n", name)
return errors.Errorf("unable to remove repo %s, does not exist.", name)
}
DNFConf.DeleteSection(name)
return DNFConf.SaveTo(b.Config.Builder.DNFConf)
err = DNFConf.SaveTo(b.Config.Builder.DNFConf)
if err != nil {
return err
}
fmt.Printf("Removing repo %s\n", name)
return nil
}
// ListRepos lists all configured repositories in the DNF configuration file.
-1
View File
@@ -131,7 +131,6 @@ func runRemoveRepo(cmd *cobra.Command, args []string) {
if err != nil {
fail(err)
}
fmt.Printf("Removed %s repo.\n", args[0])
}
func runListRepos(cmd *cobra.Command, args []string) {
-1
View File
@@ -151,7 +151,6 @@ func runRemoveRepo(cmd *cobra.Command, args []string) {
if err != nil {
fail(err)
}
fmt.Printf("Removed %s repo.\n", args[0])
}
func runListRepos(cmd *cobra.Command, args []string) {