Skip to content

Commit

Permalink
check install date is set
Browse files Browse the repository at this point in the history
  • Loading branch information
eaudetcobello committed Nov 14, 2024
1 parent dee0603 commit cf0ddec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/k8s/cmd/k8s/k8s_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func newBootstrapCmd(env cmdutil.ExecutionEnvironment) *cobra.Command {
env.Exit(1)
return
}
if microk8sInfo.StatusCode == 200 && !microk8sInfo.Result.InstallDate.IsZero() {
if microk8sInfo.StatusCode == 200 && microk8sInfo.HasInstallDate() {
cmd.PrintErrln("Error: microk8s snap is installed. Please remove it using the following command and try again:\n\n sudo snap remove microk8s")
env.Exit(1)
return
Expand Down
4 changes: 4 additions & 0 deletions src/k8s/pkg/client/snapd/snap_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ func (c *Client) GetSnapInfo(snap string) (*SnapInfoResponse, error) {

return &snapInfoResponse, nil
}

func (s SnapInfoResponse) HasInstallDate() bool {
return !s.Result.InstallDate.IsZero()
}

0 comments on commit cf0ddec

Please sign in to comment.