-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[uki] Set placeholder for actions,hooks and commands
Signed-off-by: Itxaka <[email protected]>
- Loading branch information
Showing
5 changed files
with
138 additions
and
0 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
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,29 @@ | ||
package uki | ||
|
||
import ( | ||
hook "github.com/kairos-io/kairos-agent/v2/internal/agent/hooks" | ||
"github.com/kairos-io/kairos-agent/v2/pkg/config" | ||
v1 "github.com/kairos-io/kairos-agent/v2/pkg/types/v1" | ||
elementalUtils "github.com/kairos-io/kairos-agent/v2/pkg/utils" | ||
events "github.com/kairos-io/kairos-sdk/bus" | ||
) | ||
|
||
type InstallAction struct { | ||
cfg *config.Config | ||
spec *v1.EmptySpec | ||
} | ||
|
||
func NewInstallAction(cfg *config.Config, spec *v1.EmptySpec) *InstallAction { | ||
return &InstallAction{cfg: cfg, spec: spec} | ||
} | ||
|
||
func (i *InstallAction) Run() (err error) { | ||
// Run pre-install stage | ||
_ = elementalUtils.RunStage(i.cfg, "kairos-uki-install.pre") | ||
_ = events.RunHookScript("/usr/bin/kairos-agent.uki.install.pre.hook") | ||
|
||
_ = elementalUtils.RunStage(i.cfg, "kairos-uki-install.after") | ||
_ = events.RunHookScript("/usr/bin/kairos-agent.uki.install.after.hook") //nolint:errcheck | ||
|
||
return hook.Run(*i.cfg, i.spec, hook.AfterUkiInstall...) | ||
} |
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,29 @@ | ||
package uki | ||
|
||
import ( | ||
hook "github.com/kairos-io/kairos-agent/v2/internal/agent/hooks" | ||
"github.com/kairos-io/kairos-agent/v2/pkg/config" | ||
v1 "github.com/kairos-io/kairos-agent/v2/pkg/types/v1" | ||
elementalUtils "github.com/kairos-io/kairos-agent/v2/pkg/utils" | ||
events "github.com/kairos-io/kairos-sdk/bus" | ||
) | ||
|
||
type ResetAction struct { | ||
cfg *config.Config | ||
spec *v1.EmptySpec | ||
} | ||
|
||
func NewResetAction(cfg *config.Config, spec *v1.EmptySpec) *ResetAction { | ||
return &ResetAction{cfg: cfg, spec: spec} | ||
} | ||
|
||
func (i *ResetAction) Run() (err error) { | ||
// Run pre-install stage | ||
_ = elementalUtils.RunStage(i.cfg, "kairos-uki-reset.pre") | ||
_ = events.RunHookScript("/usr/bin/kairos-agent.uki.reset.pre.hook") | ||
|
||
_ = elementalUtils.RunStage(i.cfg, "kairos-uki-reset.after") | ||
_ = events.RunHookScript("/usr/bin/kairos-agent.uki.reset.after.hook") //nolint:errcheck | ||
|
||
return hook.Run(*i.cfg, i.spec, hook.AfterUkiReset...) | ||
} |
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,29 @@ | ||
package uki | ||
|
||
import ( | ||
hook "github.com/kairos-io/kairos-agent/v2/internal/agent/hooks" | ||
"github.com/kairos-io/kairos-agent/v2/pkg/config" | ||
v1 "github.com/kairos-io/kairos-agent/v2/pkg/types/v1" | ||
elementalUtils "github.com/kairos-io/kairos-agent/v2/pkg/utils" | ||
events "github.com/kairos-io/kairos-sdk/bus" | ||
) | ||
|
||
type UpgradeAction struct { | ||
cfg *config.Config | ||
spec *v1.EmptySpec | ||
} | ||
|
||
func NewUpgradeAction(cfg *config.Config, spec *v1.EmptySpec) *UpgradeAction { | ||
return &UpgradeAction{cfg: cfg, spec: spec} | ||
} | ||
|
||
func (i *UpgradeAction) Run() (err error) { | ||
// Run pre-install stage | ||
_ = elementalUtils.RunStage(i.cfg, "kairos-uki-upgrade.pre") | ||
_ = events.RunHookScript("/usr/bin/kairos-agent.uki.upgrade.pre.hook") | ||
|
||
_ = elementalUtils.RunStage(i.cfg, "kairos-uki-upgrade.after") | ||
_ = events.RunHookScript("/usr/bin/kairos-agent.uki.upgrade.after.hook") //nolint:errcheck | ||
|
||
return hook.Run(*i.cfg, i.spec, hook.AfterUkiUpgrade...) | ||
} |