Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/service set update #272

Open
wants to merge 6 commits into
base: 2.x.x
Choose a base branch
from
Open

Fix/service set update #272

wants to merge 6 commits into from

Conversation

nikhil-024
Copy link

Odin version(x.y.z)

Features

Resources

string service_version = 2;
string name = 1;
string version = 2;
string tags = 3;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tags is a string?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this binary

tableData = append(tableData, row)

table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Service Name", "Service Version", "Service Action", "Service Status", "Error"})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
table.SetHeader([]string{"Service Name", "Service Version", "Service Action", "Service Status", "Error"})
table.SetHeader([]string{"Service Name", "Version", "Action", "Status", "Error"})

spinnerInstance.Stop()
var buf bytes.Buffer
table := tablewriter.NewWriter(&buf)
table.SetHeader([]string{"Service Name", "Service Version", "Service Tags", "Service Action", "Service Status", "Error"})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
table.SetHeader([]string{"Service Name", "Service Version", "Service Tags", "Service Action", "Service Status", "Error"})
table.SetHeader([]string{"Service Name", "Version", "Tags", "Action", "Status", "Error"})

@@ -63,6 +65,7 @@ func (e *Service) DeployService(ctx *context.Context, request *serviceProto.Depl
func (e *Service) DeployServiceSet(ctx *context.Context, request *serviceProto.DeployServiceSetRequest) error {
conn, requestCtx, err := grpcClient(ctx)
if err != nil {
log.Errorf("TraceID: %s", (*requestCtx).Value(constant.TraceIDKey))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this is error log?

var serviceNames []string
for _, service := range services.Services {

allowedInputsSlice := []string{"y", "n"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use constants for "y" or "n"

for _, input := range allowedInputsSlice {
allowedInputs[input] = struct{}{}
}
message := "Service already deployed with different version.Do you want to deploy service " + service.Name + " ? (y/n)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use string formatter

@surajgour-d11
Copy link
Contributor

resolve conflicts


services, errs := serviceClient.GetConflictingServices(&ctx, conflictingServicesRequest)
if errs != nil {
log.Fatal("Failed to list services with conflicting versions. ", errs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the err object printed?

val, err := inputHandler.AskWithConstraints(message, allowedInputs)

if err != nil {
log.Fatal(err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some error message here

}

if val != "y" {
log.Info("Skipping service ", service.Name, " from deploy")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use formatted strings

err := serviceClient.DeployServiceSet(&ctx, &deployServiceSetRequest)
if err != nil {
log.Fatal("Failed to deploy service ", err)
log.Fatal("Failed to deploy service set. ", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this err objected logged?

log.Info("Skipping service ", service.Name, " from deploy")
serviceNames = append(serviceNames, service.Name)
}
// Remove services from deployServiceSetRequest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this logic be part of the client? Do you think this should be handled by the deployer?

spinnerInstance.Prefix = fmt.Sprintf(" %s ", message)
spinnerInstance.Start()
}
}

log.Info(message)
fmt.Println(message)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why changed this?

client := serviceProto.NewServiceServiceClient(conn)
response, err := client.GetConflictingServices(*requestCtx, request)
if err != nil {
log.Errorf("TraceID: %s", (*requestCtx).Value(constant.TraceIDKey))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this an error log?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants