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

file.managed fails when file (which contains utf-characters in the name) exists #38282

Closed
sash-kan opened this issue Dec 15, 2016 · 2 comments · Fixed by #38283
Closed

file.managed fails when file (which contains utf-characters in the name) exists #38282

sash-kan opened this issue Dec 15, 2016 · 2 comments · Fixed by #38283
Labels
Bug broken, incorrect, or confusing behavior P4 Priority 4 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around State-Module
Milestone

Comments

@sash-kan
Copy link
Contributor

Description of Issue/Question

file.managed successfully creates new file (which contains utf-characters in the name), but fails when file exists.

Setup

master:

$ salt --version
salt 2016.11.1 (Carbon)
$ cat /srv/salt/test-copy-file.sls
create file:
  file.managed:
    - name: "/tmp/test.по-русски"
    - contents: |
        something

minion:

$ salt-minion --version
salt-minion 2016.11.1 (Carbon)
$ cat /etc/salt/minion.d/utf8.conf
yaml_utf8: True

Steps to Reproduce Issue

first run, file does not exist:

$ salt --state-output=full 'robbobookmint10' state.apply test-copy-file
robbobookmint10:
----------
          ID: create file
    Function: file.managed
        Name: /tmp/test.по-русски
      Result: True
     Comment: File /tmp/test.по-русски updated
     Started: 21:18:00.423726
    Duration: 232.141 ms
     Changes:   
              ----------
              diff:
                  New file

Summary for robbobookmint10
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
Total run time: 232.141 ms

second run, file exists:

$ salt --state-output=full 'robbobookmint10' state.apply test-copy-file
robbobookmint10:
----------
          ID: create file
    Function: file.managed
        Name: /tmp/test.по-русски
      Result: False
     Comment: Unable to manage file: 'ascii' codec can't decode byte 0xd0 in position 10: ordinal not in range(128)
     Started: 21:20:05.755700
    Duration: 23.975 ms
     Changes:   

Summary for robbobookmint10
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:  23.975 ms
ERROR: Minions returned with non-zero exit code

Versions Report

master:

$ salt --versions-report
Salt Version:
           Salt: 2016.11.1
 
Dependency Versions:
           cffi: 0.8.6
       cherrypy: Not Installed
       dateutil: 2.2
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
         Jinja2: 2.7.3
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.2
   mysql-python: 1.2.3
      pycparser: 2.10
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.9 (default, Jun 29 2016, 13:08:31)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.4.0
           RAET: Not Installed
          smmap: 0.8.2
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
 
System Versions:
           dist: debian 8.6 
        machine: x86_64
        release: 3.16.0-4-amd64
         system: Linux
        version: debian 8.6

minion:

$ salt-minion --versions-report
Salt Version:
           Salt: 2016.11.1
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.21.1
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.12 (default, Nov 19 2016, 06:48:10)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: LinuxMint 18 sarah
        machine: i686
        release: 4.4.0-21-generic
         system: Linux
        version: LinuxMint 18 sarah
@Ch3LL
Copy link
Contributor

Ch3LL commented Dec 15, 2016

@sash-kan thanks for the PR! Once it has been reviewed and merged please feel free to close this or we can :)

@Ch3LL Ch3LL added Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around P4 Priority 4 Platform Relates to OS, containers, platform-based utilities like FS, system based apps State-Module labels Dec 15, 2016
@Ch3LL Ch3LL added this to the Approved milestone Dec 15, 2016
@terminalmage
Copy link
Contributor

Note: #38283 is not the correct fix, it causes breakage elsewhere. #38415 is the correct fix, and has been submitted against the 2016.3 branch to ensure that the fix propagates down to all supported releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior P4 Priority 4 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around State-Module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants