-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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 support for win_copy, win_file and win_template modules. #9611
Add support for win_copy, win_file and win_template modules. #9611
Conversation
This PR is based on Chris Church's suggestions of 14 Oct 2014 here: https://groups.google.com/forum/#!topic/ansible-devel/Jl5qP73CiKo I have moved the md5 checksum-calculating logic into lib/ansible/module_utils/powershell.ps1 and out of win_stat.ps1 so its available to all modules using WANT_POWERSHELL Observations.The integration tests look messy now as I have left in commented out tests (which are all just copied from non-windows versions), really so others can review. I would be grateful for a review of the module documentation as there aren't currently many examples. I have not been able run the integration tests against window server 2008 or 2008 r2. In use, care has to be taken when specifying windows paths, especially if you are using a combination of vars and hardcoded paths as Using the -v option with ansible-playbook can be very helpful here as it will show the generated paths. One thing that makes this much easier to handle is that recent versions of windows now accept / or \ for a path separator on windows systems calls. For example in the integration tests, the win_output_dir var is specified as 'C:/temp/' The following variations all fail because some of the tasks specify a directory to copy to without a trailing / or \ don't use:win_output_dir: 'C:\temp' And this also fails seeming because the \t part of the name is unescaped to tab character. don't use either:win_output_dir: "C:\temp" ansible-playbook -v output demonstrates this: TASK: [test_win_file | verify that we are checking a file and it is present] *** Currently if you hit this, you will get a stacktrace from (the excellently Pythonically-named) splitter.py fatal: [WinTestHost] => Traceback (most recent call last): Using -v it is relatively straightforward to avoid however. Throwing an ansible exception under the circumstances might be sufficient, The initial version of this also had the following notes, which are no longer true: "I have not tackled moving the checksum logic to sha1 hashes so these modules just use md5 checksums. I had to modify the windows version of fetch.py action plugin to get the existing integration tests to pass." |
argh, just realised I have merge conflicts. Off to work out how to resolve them. |
0d29640
to
d2beceb
Compare
rebased, after a fair bit of git magic. |
@jhawkesworth From looking at some of your changes, I noticed that the md5 to sha1 updates hadn't been applied for PowerShell, so I'd fixed those in #9688. My changes there conflicted with some of yours here, so you'll need to rebase this PR. |
Thanks for this, once I've rebased the change will be more focused. |
|
||
if dest.endswith("\\"): # TODO: Check that this fixes the path for Windows hosts. | ||
base = os.path.basename(source) | ||
dest = os.path.join(dest, base) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might suggest use conn.shell.has_trailing_slash
and conn.shell.join_path
like the copy module for any path manipulations on dest
.
I have switched to using conn.shell.has_trailing_slash and conn.shell.join_path in win_template.py. |
f677310
to
3afff1a
Compare
Rebased again. In the process I noticed that I hadn't actually switched the powershell modules over to using SHA1 checksums, so I have fixed that and pushed against https://ansible/ansible-modules-core#384 |
Rebase RequestHi! Thanks very much for your submission to Ansible. It sincerely means a lot to us. It looks like the code underneath has changed since this was submitted. Can you take care of rebasing this for us?
Just as a quick reminder of things, this is a really busy project. We have over 800 contributors and to manage the queue effectively We will definitely see your comments on this issue when reading this ticket, but may not be able to reply promptly. You may also wish to join one of our two mailing lists
Thank you once again for this and your interest in Ansible! |
Now uses sha1 checksums following merge of 9688. Also I undid the changes I made to fetch.py win_template.py now uses conn.shell.has_trailing_slash and conn.shell.join_path updated integration tests.
3afff1a
to
e37b633
Compare
Rebased, as requested. For what its worth, I had a failure running the new win_feature integration Jon On Tue, Dec 16, 2014 at 1:22 AM, Brian Coca notifications@github.com
|
…ible_core_1 Add support for win_copy, win_file and win_template modules.
Thanks for this. How on earth you guys get through so much stuff I will never know! ** please reply to my unity.demon.co.uk address, not googlemail. Thanks! **
|
This PR is for the supporting action plugins and integration tests needed to support the core windows modules available from ansible/ansible-modules-core#384
Both this PR and the one referenced above would be needed to add win_copy, win_file and win_template modules.