Skip to content

Commit

Permalink
Merge pull request #12499 from monstermunchkin/misc/lxc-delete
Browse files Browse the repository at this point in the history
lxc/delete: Include instance name in error message
  • Loading branch information
monstermunchkin authored Nov 7, 2023
2 parents c135fa3 + 091045c commit 49c1fd4
Show file tree
Hide file tree
Showing 41 changed files with 527 additions and 122 deletions.
9 changes: 7 additions & 2 deletions lxc/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ func (c *cmdDelete) Run(cmd *cobra.Command, args []string) error {

// Process with deletion.
for _, resource := range resources {
connInfo, err := resource.server.GetConnectionInfo()
if err != nil {
return err
}

if c.flagInteractive {
err := c.promptDelete(resource.name)
if err != nil {
Expand All @@ -102,7 +107,7 @@ func (c *cmdDelete) Run(cmd *cobra.Command, args []string) error {
if shared.IsSnapshot(resource.name) {
err := c.doDelete(resource.server, resource.name)
if err != nil {
return err
return fmt.Errorf(i18n.G("Failed deleting instance snapshot %q in project %q: %w"), resource.name, connInfo.Project, err)
}

continue
Expand Down Expand Up @@ -160,7 +165,7 @@ func (c *cmdDelete) Run(cmd *cobra.Command, args []string) error {

err = c.doDelete(resource.server, resource.name)
if err != nil {
return err
return fmt.Errorf(i18n.G("Failed deleting instance %q in project %q: %w"), resource.name, connInfo.Project, err)
}
}
return nil
Expand Down
16 changes: 13 additions & 3 deletions po/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: lxd@lists.canonical.com\n"
"POT-Creation-Date: 2023-11-05 22:14+0000\n"
"POT-Creation-Date: 2023-11-07 10:34+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
Expand Down Expand Up @@ -2061,6 +2061,16 @@ msgstr ""
msgid "Failed converting token operation to certificate add token: %w"
msgstr ""

#: lxc/delete.go:168
#, c-format
msgid "Failed deleting instance %q in project %q: %w"
msgstr ""

#: lxc/delete.go:110
#, c-format
msgid "Failed deleting instance snapshot %q in project %q: %w"
msgstr ""

#: lxc/file.go:1174
#, c-format
msgid "Failed generating SSH host key: %w"
Expand Down Expand Up @@ -5230,7 +5240,7 @@ msgstr ""
msgid "Stopping instance failed!"
msgstr ""

#: lxc/delete.go:134
#: lxc/delete.go:139
#, c-format
msgid "Stopping the instance failed: %s"
msgstr ""
Expand Down Expand Up @@ -5394,7 +5404,7 @@ msgstr ""
msgid "The direction argument must be one of: ingress, egress"
msgstr ""

#: lxc/delete.go:118
#: lxc/delete.go:123
msgid "The instance is currently running, stop it first or pass --force"
msgstr ""

Expand Down
16 changes: 13 additions & 3 deletions po/ber.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: lxd@lists.canonical.com\n"
"POT-Creation-Date: 2023-11-05 22:14+0000\n"
"POT-Creation-Date: 2023-11-07 10:34+0100\n"
"PO-Revision-Date: 2022-03-10 15:10+0000\n"
"Last-Translator: Anonymous <noreply@weblate.org>\n"
"Language-Team: Berber <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -2064,6 +2064,16 @@ msgstr ""
msgid "Failed converting token operation to certificate add token: %w"
msgstr ""

#: lxc/delete.go:168
#, c-format
msgid "Failed deleting instance %q in project %q: %w"
msgstr ""

#: lxc/delete.go:110
#, c-format
msgid "Failed deleting instance snapshot %q in project %q: %w"
msgstr ""

#: lxc/file.go:1174
#, c-format
msgid "Failed generating SSH host key: %w"
Expand Down Expand Up @@ -5233,7 +5243,7 @@ msgstr ""
msgid "Stopping instance failed!"
msgstr ""

#: lxc/delete.go:134
#: lxc/delete.go:139
#, c-format
msgid "Stopping the instance failed: %s"
msgstr ""
Expand Down Expand Up @@ -5397,7 +5407,7 @@ msgstr ""
msgid "The direction argument must be one of: ingress, egress"
msgstr ""

#: lxc/delete.go:118
#: lxc/delete.go:123
msgid "The instance is currently running, stop it first or pass --force"
msgstr ""

Expand Down
16 changes: 13 additions & 3 deletions po/bg.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: lxd@lists.canonical.com\n"
"POT-Creation-Date: 2023-11-05 22:14+0000\n"
"POT-Creation-Date: 2023-11-07 10:34+0100\n"
"PO-Revision-Date: 2022-03-10 15:09+0000\n"
"Last-Translator: Anonymous <noreply@weblate.org>\n"
"Language-Team: Bulgarian <https://hosted.weblate.org/projects/linux-"
Expand Down Expand Up @@ -2064,6 +2064,16 @@ msgstr ""
msgid "Failed converting token operation to certificate add token: %w"
msgstr ""

#: lxc/delete.go:168
#, c-format
msgid "Failed deleting instance %q in project %q: %w"
msgstr ""

#: lxc/delete.go:110
#, c-format
msgid "Failed deleting instance snapshot %q in project %q: %w"
msgstr ""

#: lxc/file.go:1174
#, c-format
msgid "Failed generating SSH host key: %w"
Expand Down Expand Up @@ -5233,7 +5243,7 @@ msgstr ""
msgid "Stopping instance failed!"
msgstr ""

#: lxc/delete.go:134
#: lxc/delete.go:139
#, c-format
msgid "Stopping the instance failed: %s"
msgstr ""
Expand Down Expand Up @@ -5397,7 +5407,7 @@ msgstr ""
msgid "The direction argument must be one of: ingress, egress"
msgstr ""

#: lxc/delete.go:118
#: lxc/delete.go:123
msgid "The instance is currently running, stop it first or pass --force"
msgstr ""

Expand Down
16 changes: 13 additions & 3 deletions po/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: lxd@lists.canonical.com\n"
"POT-Creation-Date: 2023-11-05 22:14+0000\n"
"POT-Creation-Date: 2023-11-07 10:34+0100\n"
"PO-Revision-Date: 2022-03-10 15:10+0000\n"
"Last-Translator: Anonymous <noreply@weblate.org>\n"
"Language-Team: Catalan <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -2064,6 +2064,16 @@ msgstr ""
msgid "Failed converting token operation to certificate add token: %w"
msgstr ""

#: lxc/delete.go:168
#, c-format
msgid "Failed deleting instance %q in project %q: %w"
msgstr ""

#: lxc/delete.go:110
#, c-format
msgid "Failed deleting instance snapshot %q in project %q: %w"
msgstr ""

#: lxc/file.go:1174
#, c-format
msgid "Failed generating SSH host key: %w"
Expand Down Expand Up @@ -5233,7 +5243,7 @@ msgstr ""
msgid "Stopping instance failed!"
msgstr ""

#: lxc/delete.go:134
#: lxc/delete.go:139
#, c-format
msgid "Stopping the instance failed: %s"
msgstr ""
Expand Down Expand Up @@ -5397,7 +5407,7 @@ msgstr ""
msgid "The direction argument must be one of: ingress, egress"
msgstr ""

#: lxc/delete.go:118
#: lxc/delete.go:123
msgid "The instance is currently running, stop it first or pass --force"
msgstr ""

Expand Down
16 changes: 13 additions & 3 deletions po/cs.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: lxd@lists.canonical.com\n"
"POT-Creation-Date: 2023-11-05 22:14+0000\n"
"POT-Creation-Date: 2023-11-07 10:34+0100\n"
"PO-Revision-Date: 2022-03-10 15:11+0000\n"
"Last-Translator: Anonymous <noreply@weblate.org>\n"
"Language-Team: Czech <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -2064,6 +2064,16 @@ msgstr ""
msgid "Failed converting token operation to certificate add token: %w"
msgstr ""

#: lxc/delete.go:168
#, c-format
msgid "Failed deleting instance %q in project %q: %w"
msgstr ""

#: lxc/delete.go:110
#, c-format
msgid "Failed deleting instance snapshot %q in project %q: %w"
msgstr ""

#: lxc/file.go:1174
#, c-format
msgid "Failed generating SSH host key: %w"
Expand Down Expand Up @@ -5233,7 +5243,7 @@ msgstr ""
msgid "Stopping instance failed!"
msgstr ""

#: lxc/delete.go:134
#: lxc/delete.go:139
#, c-format
msgid "Stopping the instance failed: %s"
msgstr ""
Expand Down Expand Up @@ -5397,7 +5407,7 @@ msgstr ""
msgid "The direction argument must be one of: ingress, egress"
msgstr ""

#: lxc/delete.go:118
#: lxc/delete.go:123
msgid "The instance is currently running, stop it first or pass --force"
msgstr ""

Expand Down
16 changes: 13 additions & 3 deletions po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: LXD\n"
"Report-Msgid-Bugs-To: lxd@lists.canonical.com\n"
"POT-Creation-Date: 2023-11-05 22:14+0000\n"
"POT-Creation-Date: 2023-11-07 10:34+0100\n"
"PO-Revision-Date: 2022-03-10 15:06+0000\n"
"Last-Translator: Krombel <krombel@krombel.de>\n"
"Language-Team: German <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -2437,6 +2437,16 @@ msgstr "kann nicht zum selben Container Namen kopieren"
msgid "Failed converting token operation to certificate add token: %w"
msgstr ""

#: lxc/delete.go:168
#, fuzzy, c-format
msgid "Failed deleting instance %q in project %q: %w"
msgstr "kann nicht zum selben Container Namen kopieren"

#: lxc/delete.go:110
#, fuzzy, c-format
msgid "Failed deleting instance snapshot %q in project %q: %w"
msgstr "kann nicht zum selben Container Namen kopieren"

#: lxc/file.go:1174
#, fuzzy, c-format
msgid "Failed generating SSH host key: %w"
Expand Down Expand Up @@ -5831,7 +5841,7 @@ msgstr ""
msgid "Stopping instance failed!"
msgstr "Anhalten des Containers fehlgeschlagen!"

#: lxc/delete.go:134
#: lxc/delete.go:139
#, fuzzy, c-format
msgid "Stopping the instance failed: %s"
msgstr "Anhalten des Containers fehlgeschlagen!"
Expand Down Expand Up @@ -6005,7 +6015,7 @@ msgstr "entfernte Instanz %s existiert bereits"
msgid "The direction argument must be one of: ingress, egress"
msgstr ""

#: lxc/delete.go:118
#: lxc/delete.go:123
msgid "The instance is currently running, stop it first or pass --force"
msgstr ""

Expand Down
16 changes: 13 additions & 3 deletions po/el.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: lxd@lists.canonical.com\n"
"POT-Creation-Date: 2023-11-05 22:14+0000\n"
"POT-Creation-Date: 2023-11-07 10:34+0100\n"
"PO-Revision-Date: 2022-03-10 15:06+0000\n"
"Last-Translator: Anonymous <noreply@weblate.org>\n"
"Language-Team: Greek <https://hosted.weblate.org/projects/linux-containers/"
Expand Down Expand Up @@ -2084,6 +2084,16 @@ msgstr " Χρήση δικτύου:"
msgid "Failed converting token operation to certificate add token: %w"
msgstr ""

#: lxc/delete.go:168
#, fuzzy, c-format
msgid "Failed deleting instance %q in project %q: %w"
msgstr " Χρήση δικτύου:"

#: lxc/delete.go:110
#, fuzzy, c-format
msgid "Failed deleting instance snapshot %q in project %q: %w"
msgstr " Χρήση δικτύου:"

#: lxc/file.go:1174
#, c-format
msgid "Failed generating SSH host key: %w"
Expand Down Expand Up @@ -5317,7 +5327,7 @@ msgstr ""
msgid "Stopping instance failed!"
msgstr ""

#: lxc/delete.go:134
#: lxc/delete.go:139
#, c-format
msgid "Stopping the instance failed: %s"
msgstr ""
Expand Down Expand Up @@ -5481,7 +5491,7 @@ msgstr ""
msgid "The direction argument must be one of: ingress, egress"
msgstr ""

#: lxc/delete.go:118
#: lxc/delete.go:123
msgid "The instance is currently running, stop it first or pass --force"
msgstr ""

Expand Down
16 changes: 13 additions & 3 deletions po/eo.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lxd\n"
"Report-Msgid-Bugs-To: lxd@lists.canonical.com\n"
"POT-Creation-Date: 2023-11-05 22:14+0000\n"
"POT-Creation-Date: 2023-11-07 10:34+0100\n"
"PO-Revision-Date: 2022-03-10 15:11+0000\n"
"Last-Translator: Anonymous <noreply@weblate.org>\n"
"Language-Team: Esperanto <https://hosted.weblate.org/projects/linux-"
Expand Down Expand Up @@ -2064,6 +2064,16 @@ msgstr ""
msgid "Failed converting token operation to certificate add token: %w"
msgstr ""

#: lxc/delete.go:168
#, c-format
msgid "Failed deleting instance %q in project %q: %w"
msgstr ""

#: lxc/delete.go:110
#, c-format
msgid "Failed deleting instance snapshot %q in project %q: %w"
msgstr ""

#: lxc/file.go:1174
#, c-format
msgid "Failed generating SSH host key: %w"
Expand Down Expand Up @@ -5233,7 +5243,7 @@ msgstr ""
msgid "Stopping instance failed!"
msgstr ""

#: lxc/delete.go:134
#: lxc/delete.go:139
#, c-format
msgid "Stopping the instance failed: %s"
msgstr ""
Expand Down Expand Up @@ -5397,7 +5407,7 @@ msgstr ""
msgid "The direction argument must be one of: ingress, egress"
msgstr ""

#: lxc/delete.go:118
#: lxc/delete.go:123
msgid "The instance is currently running, stop it first or pass --force"
msgstr ""

Expand Down
Loading

0 comments on commit 49c1fd4

Please sign in to comment.