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

Add Remote FileCopy #21

Merged
merged 9 commits into from
Dec 16, 2021
Merged

Add Remote FileCopy #21

merged 9 commits into from
Dec 16, 2021

Conversation

iwahbe
Copy link
Member

@iwahbe iwahbe commented Dec 16, 2021

Adds a resource that represents moving a file from a local to a remote host.

Fixes #6

@iwahbe iwahbe self-assigned this Dec 16, 2021
Copy link
Contributor

@lukehoban lukehoban left a comment

Choose a reason for hiding this comment

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

A few comments from a first pass through.

provider/pkg/provider/provider.go Show resolved Hide resolved
provider/pkg/provider/provider.go Show resolved Hide resolved
provider/pkg/provider/remotecommand.go Show resolved Hide resolved
"context"
"os"

"github.com/pkg/sftp"
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious - as I'm not certain myself yet - but was there a reason to choose sftp over scp for this?

}

func (c *remotefilecopy) RunDelete(ctx context.Context, host *provider.HostClient, urn resource.URN) error {
host.Log(ctx, diag.Info, urn, "Deleting remotefilecopy")
Copy link
Contributor

Choose a reason for hiding this comment

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

I expect we don't need this?

(though we may benefit from debug level diagnostics in quite a few more places for future debuggability)

if err := inner(); err != nil {
return "", err
}
return resource.NewUniqueHex("", 8, 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Any opportunity to add something more semantically meaningful here? I could image deriving a prefix from the remotePath potentially? But maybe more awkward than helpful?

Copy link
Member Author

Choose a reason for hiding this comment

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

It would still need a random component because we might have an otherwise identical CopyFile with a different connection. I don't think there is much benefit. I think the same argument applies to remote:Command.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah - agreed. I was wondering similar for remote Command, but there's even less sensible to use there. Sticking with the random hex sounds good.

Copy link
Contributor

@nimbinatus nimbinatus left a comment

Choose a reason for hiding this comment

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

LGTM! I don't have any specific comments about documentation, either; everything looks nice and clean.

@iwahbe iwahbe merged commit cb10cd8 into master Dec 16, 2021
@iwahbe iwahbe deleted the iwahbe/remote-file-copy branch December 16, 2021 22:18
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.

Add support for RemoteFile (CopyFile)
3 participants