forked from canonical/snapd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
o/registrystate: create modify-registry tasks (canonical#14445)
* o/registrystate: create modify-registry tasks Adds a helper that attaches the appropriate tasks to gather approval, save, commit and notify of a change to a registry. The specific approval gathering mechanism is described in SD133. This doesn't include the task/hook handlers that deal with the specific but the whole picture can be seen in canonical#14283 Signed-off-by: Miguel Pires <miguel.pires@canonical.com> * o/registrystate: make task kinds more specific Signed-off-by: Miguel Pires <miguel.pires@canonical.com> * o/registrystate: minor fix Signed-off-by: Miguel Pires <miguel.pires@canonical.com> --------- Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
- Loading branch information
1 parent
77c0d8b
commit c21532e
Showing
4 changed files
with
571 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// -*- Mode: Go; indent-tabs-mode: t -*- | ||
/* | ||
* Copyright (C) 2024 Canonical Ltd | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 3 as | ||
* published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
package registrystate | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/snapcore/snapd/i18n" | ||
"github.com/snapcore/snapd/overlord/hookstate" | ||
"github.com/snapcore/snapd/overlord/state" | ||
) | ||
|
||
func setupRegistryHook(st *state.State, snapName, hookName string, ignoreError bool) *state.Task { | ||
hookSup := &hookstate.HookSetup{ | ||
Snap: snapName, | ||
Hook: hookName, | ||
Optional: true, | ||
IgnoreError: ignoreError, | ||
} | ||
summary := fmt.Sprintf(i18n.G("Run hook %s of snap %q"), hookName, snapName) | ||
task := hookstate.HookTask(st, summary, hookSup, nil) | ||
return task | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.