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

Cannot upload io.StringIO with non-ASCII characters #342

Closed
ilia1243 opened this issue Jan 24, 2023 · 0 comments · Fixed by #346
Closed

Cannot upload io.StringIO with non-ASCII characters #342

ilia1243 opened this issue Jan 24, 2023 · 0 comments · Fixed by #346
Assignees
Labels
bug Something isn't working

Comments

@ilia1243
Copy link
Contributor

ilia1243 commented Jan 24, 2023

Steps to reproduce:

  1. Create template files/test_cm.yaml.j2
apiVersion: v1
kind: ConfigMap
metadata:
  name: test-cm
data:
  cluster_name: "{{ cluster_name }}"
  unicode_symbol: "😀"
  1. Create custom plugin in inventory
plugins:
  ...
  my_plugin:
    install: true
    installation:
      procedures:
        - template:
            source: files/test_cm.yaml.j2
  1. Run install --tasks deploy.plugins

AR: fails with size mismatch in put! 121 != 118, see paramiko/paramiko#1133

The problem is likely actual for any upload of io.StringIO instance.

Possible solution:

When uploading of any text, manually encode it with 'utf-8' and upload as io.BytesIO

If the text is obtained from file on Windows deployer, it will need to decode it first with the same 'utf-8' to not lose the utf-8 symbols.

In other words, it is necessary to introduce new requirement for encoding of input text files and always open for reading and writing with 'utf-8' and always upload as io.BytesIO.

Prototype: eedfbf9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant