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

Fixes invalid paths when using rsync with Windows #1705

Merged

Conversation

cdrage
Copy link
Member

@cdrage cdrage commented May 8, 2019

This PR fixes the invalid paths that are being passed into OpenShift due
to using FromSlash that defaults to whatever backslash / forwardslash
the OS uses.

This changes it so that ToSlash is used for transfering as all
containers in OpenShift are Linux-based and thus forward-slashes are
required.

Also added:

  • Checks to see if a directory is empty and error out.

To test this PR out:

  • Have a Windows-based OS
  • git clone https://github.com/openshift/nodejs-ex
  • odo create nodejs --context ~/nodejs-ex
  • odo push -v 4 --context ~/nodejs-ex
  • odo watch -v 4 --context ~/nodejs-ex

Closes issue #1429

This PR fixes the invalid paths that are being passed into OpenShift due
to using `FromSlash` that defaults to whatever backslash / forwardslash
the OS uses.

This changes it so that `ToSlash` is used for transfering as *all*
containers in OpenShift are Linux-based and thus forward-slashes are
required.

Closes issue redhat-developer#1429
@cdrage
Copy link
Member Author

cdrage commented May 9, 2019

Please ignore the cdrage:ignore-behaviour-windows name of the branch. It's related to this fix :) This fixes #1429 not #1630

Copy link
Contributor

@mohammedzee1000 mohammedzee1000 left a comment

Choose a reason for hiding this comment

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

/approve

@@ -626,6 +626,15 @@ func ApplyConfigCreateUrl(client *occlient.Client, componentConfig config.LocalC
// Error if any
func PushLocal(client *occlient.Client, componentName string, applicationName string, path string, out io.Writer, files []string, delFiles []string, isForcePush bool, globExps []string, show bool) error {
glog.V(4).Infof("PushLocal: componentName: %s, applicationName: %s, path: %s, files: %s, delFiles: %s, isForcePush: %+v", componentName, applicationName, path, files, delFiles, isForcePush)

// Edge case: check to see that the path is NOT empty.
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mohammedzee1000

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mohammedzee1000

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. labels May 10, 2019
@girishramnani
Copy link
Contributor

/retest

@girishramnani
Copy link
Contributor

if possible a unit test for CopyFile with different slashes would be great here @cdrage

@cdrage
Copy link
Member Author

cdrage commented May 10, 2019

@girishramnani I wrote a brief test for CopyFile but found it too cumbersome to actually emulate the copying over the files.

This is covered via integration tests. But I'll look into other ways to test this functionality!

@girishramnani
Copy link
Contributor

Client Version: version.Info{Major:"4", Minor:"0+", GitVersion:"v4.0.0-alpha.0+b93a8e6-2141-dirty", GitCommit:"b93a8e6", GitTreeState:"", BuildDate:"2019-04-23T21:16:33Z", GoVersion:"", Compiler:"", Platform:""}
error: You must be logged in to the server (the server has asked for the client to provide credentials)
make[1]: *** [configure-installer-tests-cluster] Error 1

Login failure
/retest

Copy link
Contributor

@surajnarwade surajnarwade left a comment

Choose a reason for hiding this comment

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

tested on linux and windows both 🎉 worked well
code wise lgtm too

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label May 15, 2019
@openshift-merge-robot openshift-merge-robot merged commit c44c335 into redhat-developer:master May 15, 2019
@cdrage cdrage deleted the ignore-behaviour-windows branch January 14, 2022 14:53
@rm3l rm3l added the estimated-size/M (10-20) Rough sizing for Epics. About 1 sprint of work for one person label Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. estimated-size/M (10-20) Rough sizing for Epics. About 1 sprint of work for one person lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants