Skip to content

Commit

Permalink
Rename ops/ and types/agent_types.go
Browse files Browse the repository at this point in the history
Signed-off-by: nagesh bansal <[email protected]>
  • Loading branch information
Nageshbansal committed Aug 18, 2023
1 parent 96ac6e2 commit 051e4ad
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions pkg/cmd/connect/infra.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"os"

"github.com/litmuschaos/litmusctl/pkg/apis"
"github.com/litmuschaos/litmusctl/pkg/infra_ops"
"github.com/litmuschaos/litmusctl/pkg/k8s"
"github.com/litmuschaos/litmusctl/pkg/ops"
"github.com/litmuschaos/litmusctl/pkg/types"
"github.com/litmuschaos/litmusctl/pkg/utils"

Expand Down Expand Up @@ -79,7 +79,7 @@ var infraCmd = &cobra.Command{

if !projectExists {
utils.White_B.Print("Creating a random project...")
newInfra.ProjectId = ops.CreateRandomProject(credentials)
newInfra.ProjectId = infra_ops.CreateRandomProject(credentials)
}
}

Expand Down Expand Up @@ -166,14 +166,14 @@ var infraCmd = &cobra.Command{

// Check if user has sufficient permissions based on mode
utils.White_B.Print("\n🏃 Running prerequisites check....")
ops.ValidateSAPermissions(newInfra.Namespace, newInfra.Mode, &kubeconfig)
infra_ops.ValidateSAPermissions(newInfra.Namespace, newInfra.Mode, &kubeconfig)

// Check if infra already exists
isInfraExist, err, infraList := ops.ValidateInfraNameExists(newInfra.InfraName, newInfra.ProjectId, credentials)
isInfraExist, err, infraList := infra_ops.ValidateInfraNameExists(newInfra.InfraName, newInfra.ProjectId, credentials)
utils.PrintError(err)

if isInfraExist {
ops.PrintExistingInfra(infraList)
infra_ops.PrintExistingInfra(infraList)
os.Exit(1)
}
envIDs, err := environment.GetEnvironmentList(newInfra.ProjectId, credentials)
Expand All @@ -190,7 +190,7 @@ var infraCmd = &cobra.Command{
}
if !isEnvExist {
utils.Red.Println("\nChaos Environment with the given ID doesn't exists.")
ops.PrintExistingEnvironments(envIDs)
infra_ops.PrintExistingEnvironments(envIDs)
utils.White_B.Println("\n❗ Please enter a name from the List or Create a new environment using `litmusctl create chaos-environment`")
os.Exit(1)
}
Expand All @@ -201,25 +201,25 @@ var infraCmd = &cobra.Command{

if newInfra.ProjectId == "" {
// Fetch project id
newInfra.ProjectId = ops.GetProjectID(userDetails)
newInfra.ProjectId = infra_ops.GetProjectID(userDetails)
}

modeType := ops.GetModeType()
modeType := infra_ops.GetModeType()

// Check if user has sufficient permissions based on mode
utils.White_B.Print("\n🏃 Running prerequisites check....")
ops.ValidateSAPermissions(newInfra.Namespace, modeType, &kubeconfig)
newInfra, err = ops.GetInfraDetails(modeType, newInfra.ProjectId, credentials, &kubeconfig)
infra_ops.ValidateSAPermissions(newInfra.Namespace, modeType, &kubeconfig)
newInfra, err = infra_ops.GetInfraDetails(modeType, newInfra.ProjectId, credentials, &kubeconfig)
utils.PrintError(err)

newInfra.ServiceAccount, newInfra.SAExists = k8s.ValidSA(newInfra.Namespace, &kubeconfig)
newInfra.Mode = modeType
}

ops.Summary(newInfra, &kubeconfig)
infra_ops.Summary(newInfra, &kubeconfig)

if !nonInteractive {
ops.ConfirmInstallation()
infra_ops.ConfirmInstallation()
}

infra, err := infrastructure.ConnectInfra(newInfra, credentials)
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/create/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
models "github.com/litmuschaos/litmus/chaoscenter/graphql/server/graph/model"
"github.com/litmuschaos/litmusctl/pkg/apis"
"github.com/litmuschaos/litmusctl/pkg/apis/environment"
"github.com/litmuschaos/litmusctl/pkg/ops"
"github.com/litmuschaos/litmusctl/pkg/infra_ops"
"github.com/litmuschaos/litmusctl/pkg/utils"
"github.com/spf13/cobra"
"os"
Expand Down Expand Up @@ -109,7 +109,7 @@ var environmentCmd = &cobra.Command{
}
if isEnvExist {
utils.Red.Println("\nChaos Environment with the given ID already exists, try with a different name")
ops.PrintExistingEnvironments(envs)
infra_ops.PrintExistingEnvironments(envs)
os.Exit(1)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/ops/ops.go → pkg/infra_ops/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package ops
package infra_ops

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ops/platform.go → pkg/infra_ops/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package ops
package infra_ops

import (
"context"
Expand Down
File renamed without changes.

0 comments on commit 051e4ad

Please sign in to comment.