Skip to content

Fix Default Workdir for Unweave Code/SSH + ExecInfo UX#14

Merged
noorvir merged 7 commits intomasterfrom
callum/unw-182-2
Jun 1, 2023
Merged

Fix Default Workdir for Unweave Code/SSH + ExecInfo UX#14
noorvir merged 7 commits intomasterfrom
callum/unw-182-2

Conversation

@caldempsey
Copy link
Copy Markdown
Contributor

@caldempsey caldempsey commented May 30, 2023

This PR cleans up some unused code in the CLI, makes UX improvements based on unweave/unweave-v1#13, and fixes a bug where the workdir used for Node and SSH was inconsistent.

image

{Key: "SSHKey", Value: fmt.Sprintf("%s", exec.SSHKey.Name)},
{Key: "CPUs", Value: fmt.Sprintf("%v", exec.Specs.CPU.Min)},
// Uncomment when issues setting RAM are resolved
// {Key: "RAM", Value: fmt.Sprintf("%vGB", exec.Specs.RAM.Min)},
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

uncomment this line when ready

Comment on lines -170 to -189

// getExecByNameOrID invokes the UnweaveClient and returns the container execution associated a name or ID that matches a given string
func getExecByNameOrID(ctx context.Context, ref string) (*types.Exec, error) {
execs, err := getExecs(ctx)
if err != nil {
return nil, err
}

for _, e := range execs {
// handle a case where the user accidentally input the execRef ID as the name
if ref == e.Name {
return &e, nil
}
if ref == e.ID {
return &e, nil
}
}

return nil, fmt.Errorf("session %s does not exist", ref)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we not use this anymore? I'm not sure this should be removed since we want to implement getting info about an exec soon.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No references anywhere, will keep it in if you want but I'm an evangelicalist about removing dead code and dead features

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We'll probably implement this very soon so let's leave it.

Comment on lines +13 to +22
func ProjectHostDir() string {
absPath, err := filepath.Abs(".")
if err != nil {
ui.HandleError(err)
}

_, rootDir := filepath.Split(absPath)

return filepath.Join(UnweaveHostDir, rootDir)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not correct. The user can be executing an unweave command from a subdirectory too. We have a utility to get the project linked directory here

@caldempsey caldempsey requested a review from noorvir June 1, 2023 13:10
@noorvir noorvir merged commit f4a099d into master Jun 1, 2023
@noorvir noorvir deleted the callum/unw-182-2 branch June 1, 2023 14:38
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.

2 participants