You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by GitBox <gi...@apache.org> on 2021/09/14 08:17:19 UTC

[GitHub] [libcloud] atarbalouti opened a new pull request #1602: fix linux command deployment when running libcloud on windows

atarbalouti opened a new pull request #1602:
URL: https://github.com/apache/libcloud/pull/1602


   ## Fix right path composition suited for destination machine
   
   ### Description
   
   When running libcloud on Windows to deploy a linux machine in the cloud with a ScriptDeployment, it had always promted me an error which was like "stderr: bash: /home/googlelibcloud_deployment_b20d6e1e.sh: No such file or directory". So, the path was not right formatted. The error was in the os.path.join method, which produces a false path on windows like "/home/google\\libcloud_deployment_b20d6e1e.sh". So I had to add the .replace("\\","/") method to the os.path.join.
   
   ### Status
   
   - done, ready for review
   
   ### Checklist (tick everything that applies)
   
   - [x] [Code linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide) (required, can be done after the PR checks)
   - [ ] Documentation
   - [ ] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html)
   - [ ] [ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes) (required for bigger changes)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@libcloud.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [libcloud] Kami commented on a change in pull request #1602: fix linux command deployment when running libcloud on windows

Posted by GitBox <gi...@apache.org>.
Kami commented on a change in pull request #1602:
URL: https://github.com/apache/libcloud/pull/1602#discussion_r734352671



##########
File path: libcloud/compute/deployment.py
##########
@@ -212,7 +212,7 @@ def run(self, node, client):
         if self.name and (self.name[0] not in ['/', '\\'] and
                           not re.match(r"^\w\:.*$", file_path)):
             base_path = os.path.dirname(file_path)
-            name = os.path.join(base_path, self.name)
+            name = os.path.join(base_path, self.name).replace("\\", "/")

Review comment:
       Hm, I believe this will also replace slashes on Linux, right?
   
   If so, we should make sure this replace only runs when running deployment step on Windows target.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@libcloud.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [libcloud] Kami commented on pull request #1602: fix linux command deployment when running libcloud on windows

Posted by GitBox <gi...@apache.org>.
Kami commented on pull request #1602:
URL: https://github.com/apache/libcloud/pull/1602#issuecomment-949418409


   Thanks for the contribution.
   
   I added some comments - I believe those changes may also affect Linux targets which is likely not what we want. Ideally there would also be some unit tests to begin with.
   
   I know we had some Windows target deployment related issues in the past, but I also know we have deployment stuff being used on Windows targets without any issues so it's likely some edge case which current code is not correctly handling.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@libcloud.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [libcloud] Kami commented on a change in pull request #1602: fix linux command deployment when running libcloud on windows

Posted by GitBox <gi...@apache.org>.
Kami commented on a change in pull request #1602:
URL: https://github.com/apache/libcloud/pull/1602#discussion_r734352851



##########
File path: libcloud/compute/ssh.py
##########
@@ -688,7 +688,7 @@ def _sanitize_file_path(self, cwd, file_path):
                 # Windows path
                 file_path = cwd + '\\' + file_path
             else:
-                file_path = pjoin(cwd, file_path)
+                file_path = pjoin(cwd, file_path).replace("\\", "/")

Review comment:
       Same here, I believe this will also run on Linux target which will likely cause issues.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@libcloud.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org