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 windows_file.template operation #651

Open
wants to merge 1 commit into
base: 1.x
Choose a base branch
from

Conversation

timeisapear
Copy link

Mostly copy/pasted from file.template. One tweak is making the IO buffer-type bytes since
winrm connector _put_file expects a bytes input. Therefore output_file was changed from:

output_file = six.StringIO(output)

to

output_file = six.BytesIO(six.ensure_binary(output))

References #645

I have not added tests yet but may be able to add them later.

@codecov
Copy link

codecov bot commented Sep 2, 2021

Codecov Report

Merging #651 (be8f856) into current (2fec4e3) will decrease coverage by 0.82%.
The diff coverage is 87.10%.

❗ Current head be8f856 differs from pull request most recent head 325b214. Consider uploading reports for the commit 325b214 to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##           current     #651      +/-   ##
===========================================
- Coverage    92.51%   91.69%   -0.83%     
===========================================
  Files          123      121       -2     
  Lines         7440     7367      -73     
===========================================
- Hits          6883     6755     -128     
- Misses         557      612      +55     
Impacted Files Coverage Δ
pyinfra/api/connectors/winrm.py 52.00% <ø> (+0.51%) ⬆️
pyinfra/operations/bsdinit.py 100.00% <ø> (ø)
pyinfra/operations/launchd.py 100.00% <ø> (ø)
pyinfra/operations/systemd.py 100.00% <ø> (ø)
pyinfra/operations/sysvinit.py 100.00% <ø> (ø)
pyinfra/operations/upstart.py 100.00% <ø> (ø)
pyinfra/operations/util/service.py 100.00% <ø> (ø)
pyinfra/api/connectors/sshuserclient/client.py 48.00% <16.66%> (-34.72%) ⬇️
pyinfra/operations/windows_files.py 58.33% <24.00%> (-8.07%) ⬇️
pyinfra_cli/config.py 44.44% <33.33%> (ø)
... and 69 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2fec4e3...325b214. Read the comment docs.

Copy link
Member

@Fizzadar Fizzadar left a comment

Choose a reason for hiding this comment

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

Hi @timeisapear - thank you for adding this, looks great overall. Once minor comment and the tests - I'm happy to add tests after merging for this if you'd like me to?


.. code:: python

files.template(
Copy link
Member

Choose a reason for hiding this comment

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

These examples need to be windows_files.templates.

Mostly copy/pasted from file.template. One tweak is making the IO buffer-type bytes since
win_rm _put_file expects a bytes input. Therefore output_file was changed from:

```
output_file = six.StringIO(output)
```
 to

```
output_file = six.BytesIO(six.ensure_binary(output))
```

References pyinfra-dev#645
@Fizzadar Fizzadar changed the base branch from current to 1.x March 30, 2022 09:56
@Fizzadar
Copy link
Member

v3 will remove Windows support (into a separate package, https://github.com/pyinfra-dev/pyinfra-windows. Once that's released I shall move this over and close this PR.

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.

None yet

2 participants