Skip to content

Commit

Permalink
fixed the nil pointer issue for --approve -> --yes
Browse files Browse the repository at this point in the history
Signed-off-by: Dipankar Das <65275144+dipankardas011@users.noreply.github.com>
  • Loading branch information
dipankardas011 committed May 31, 2024
1 parent 838af7f commit 56c26c5
Show file tree
Hide file tree
Showing 10 changed files with 402 additions and 403 deletions.
758 changes: 379 additions & 379 deletions .github/workflows/test-mock.bkp.yml

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions .github/workflows/test-mock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,24 @@ jobs:
cd .\scripts
.\builder.ps1
cd C:\Users\runneradmin\AppData\Local\ksctl
.\ksctl.exe version
echo "KSCTL_BIN=.\C:\Users\runneradmin\AppData\Local\ksctl\ksctl.exe" >> ${GITHUB_ENV}
${{ env.KSCTL_BIN }} version
- name: build ksctl linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
make install_linux
ksctl version
echo "KSCTL_BIN=ksctl" >> ${GITHUB_ENV}
${{ env.KSCTL_BIN }} version
- name: build ksctl macos
if: ${{ matrix.os == 'macos-latest' }}
run: |
make install_macos_intel
ksctl version
echo "KSCTL_BIN=ksctl" >> ${GITHUB_ENV}
${{ env.KSCTL_BIN }} version
- name: civo create
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/addNodesHAAws.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ksctl create ha-aws add-nodes -n demo -r ap-south-1 -s store-local --noWP 3 --no
cli.Client.Metadata.K8sVersion = k8sVer
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

if err := createApproval(ctx, log, cmd.Flags().Lookup("approve").Changed); err != nil {
if err := createApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil {
log.Error(ctx, "createApproval", "Reason", err)
os.Exit(1)
}
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/addNodesHAAzure.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ksctl create ha-azure add-nodes -n demo -r eastus -s store-local --noWP 3 --node
cli.Client.Metadata.K8sVersion = k8sVer
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

if err := createApproval(ctx, log, cmd.Flags().Lookup("approve").Changed); err != nil {
if err := createApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil {
log.Error(ctx, "createApproval", "Reason", err)
os.Exit(1)
}
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/addNodesHACivo.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ksctl create ha-civo add-nodes -n demo -r LON1 -s store-local --noWP 3 --nodeSiz
cli.Client.Metadata.IsHA = true
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

if err := createApproval(ctx, log, cmd.Flags().Lookup("approve").Changed); err != nil {
if err := createApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil {
log.Error(ctx, "createApproval", "Reason", err)
os.Exit(1)
}
Expand Down
12 changes: 6 additions & 6 deletions cli/cmd/createCluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ksctl create-cluster ha-aws -n demo -r us-east-1 --bootstrap k3s -s store-local

SetDefaults(consts.CloudAws, consts.ClusterTypeHa)

createHA(ctx, log, cmd.Flags().Lookup("approve").Changed)
createHA(ctx, log, cmd.Flags().Lookup("yes").Changed)
},
}

Expand All @@ -58,7 +58,7 @@ var createClusterAzure = &cobra.Command{

SetDefaults(consts.CloudAzure, consts.ClusterTypeMang)

createManaged(ctx, log, cmd.Flags().Lookup("approve").Changed)
createManaged(ctx, log, cmd.Flags().Lookup("yes").Changed)
},
}

Expand All @@ -78,7 +78,7 @@ ksctl create-cluster civo <arguments to cloud provider>

SetDefaults(consts.CloudCivo, consts.ClusterTypeMang)

createManaged(ctx, log, cmd.Flags().Lookup("approve").Changed)
createManaged(ctx, log, cmd.Flags().Lookup("yes").Changed)
},
}

Expand All @@ -98,7 +98,7 @@ ksctl create-cluster local <arguments to cloud provider>

SetDefaults(consts.CloudLocal, consts.ClusterTypeMang)

createManaged(ctx, log, cmd.Flags().Lookup("approve").Changed)
createManaged(ctx, log, cmd.Flags().Lookup("yes").Changed)
},
}

Expand All @@ -118,7 +118,7 @@ ksctl create-cluster ha-civo <arguments to cloud provider>

SetDefaults(consts.CloudCivo, consts.ClusterTypeHa)

createHA(ctx, log, cmd.Flags().Lookup("approve").Changed)
createHA(ctx, log, cmd.Flags().Lookup("yes").Changed)
},
}

Expand All @@ -138,7 +138,7 @@ var createClusterHAAzure = &cobra.Command{

SetDefaults(consts.CloudAzure, consts.ClusterTypeHa)

createHA(ctx, log, cmd.Flags().Lookup("approve").Changed)
createHA(ctx, log, cmd.Flags().Lookup("yes").Changed)
},
}

Expand Down
12 changes: 6 additions & 6 deletions cli/cmd/deleteCluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ksctl create-cluster azure <arguments to civo cloud provider>

SetDefaults(consts.CloudAzure, consts.ClusterTypeMang)

deleteManaged(ctx, log, cmd.Flags().Lookup("approve").Changed)
deleteManaged(ctx, log, cmd.Flags().Lookup("yes").Changed)
},
}

Expand All @@ -58,7 +58,7 @@ ksctl delete-cluster civo

SetDefaults(consts.CloudCivo, consts.ClusterTypeMang)

deleteManaged(ctx, log, cmd.Flags().Lookup("approve").Changed)
deleteManaged(ctx, log, cmd.Flags().Lookup("yes").Changed)

},
}
Expand All @@ -79,7 +79,7 @@ var deleteClusterHAAws = &cobra.Command{

SetDefaults(consts.CloudAws, consts.ClusterTypeHa)

deleteHA(ctx, log, cmd.Flags().Lookup("approve").Changed)
deleteHA(ctx, log, cmd.Flags().Lookup("yes").Changed)
},
}

Expand All @@ -99,7 +99,7 @@ var deleteClusterHAAzure = &cobra.Command{

SetDefaults(consts.CloudAzure, consts.ClusterTypeHa)

deleteHA(ctx, log, cmd.Flags().Lookup("approve").Changed)
deleteHA(ctx, log, cmd.Flags().Lookup("yes").Changed)
},
}

Expand All @@ -119,7 +119,7 @@ ksctl delete-cluster ha-civo <arguments to cloud provider>

SetDefaults(consts.CloudCivo, consts.ClusterTypeHa)

deleteHA(ctx, log, cmd.Flags().Lookup("approve").Changed)
deleteHA(ctx, log, cmd.Flags().Lookup("yes").Changed)
},
}

Expand All @@ -139,7 +139,7 @@ ksctl delete-cluster local <arguments to local/Docker provider>

SetDefaults(consts.CloudLocal, consts.ClusterTypeMang)

deleteManaged(ctx, log, cmd.Flags().Lookup("approve").Changed)
deleteManaged(ctx, log, cmd.Flags().Lookup("yes").Changed)
},
}

Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/deleteNodesHAAws.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ksctl delete-cluster ha-aws delete-nodes <arguments to cloud provider>
cli.Client.Metadata.K8sDistro = consts.KsctlKubernetes(distro)
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

if err := deleteApproval(ctx, log, cmd.Flags().Lookup("approve").Changed); err != nil {
if err := deleteApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil {
log.Error(ctx, "deleteApproval", "Reason", err)
os.Exit(1)
}
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/deleteNodesHAAzure.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ksctl delete-cluster ha-azure delete-nodes <arguments to cloud provider>
cli.Client.Metadata.K8sDistro = consts.KsctlKubernetes(distro)
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

if err := deleteApproval(ctx, log, cmd.Flags().Lookup("approve").Changed); err != nil {
if err := deleteApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil {
log.Error(ctx, "deleteApproval", "Reason", err)
os.Exit(1)
}
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/deleteNodesHACivo.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ksctl delete-cluster ha-civo delete-nodes <arguments to cloud provider>
cli.Client.Metadata.K8sDistro = consts.KsctlKubernetes(distro)
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

if err := deleteApproval(ctx, log, cmd.Flags().Lookup("approve").Changed); err != nil {
if err := deleteApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil {
log.Error(ctx, "deleteApproval", "Reason", err)
os.Exit(1)
}
Expand Down

0 comments on commit 56c26c5

Please sign in to comment.