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.symlink should not try to set ownership to root:root #39360

Closed
bbinet opened this issue Feb 13, 2017 · 1 comment
Closed

file.symlink should not try to set ownership to root:root #39360

bbinet opened this issue Feb 13, 2017 · 1 comment
Labels
Feature new functionality including changes to functionality and code refactors, etc. stale
Milestone

Comments

@bbinet
Copy link
Contributor

bbinet commented Feb 13, 2017

Description of Issue/Question

When I run a simple state to create a symlink with file.symlink, salt tries to set ownership to root:root whereas I'm not running salt as root (masterless setup).

After investigating, it seems that __opts__['user'] is set to root while it should be set to bruno which is the user that runs the salt command.
See https://github.com/saltstack/salt/blob/2016.11/salt/states/file.py#L863-L864

Setup

(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)

symling_test:
  file.symlink:
  - name: {{ grains['root'] }}/symlink
  - target: {{ grains['root'] }}/

Steps to Reproduce Issue

(Include debug logs if possible and relevant.)

$ python2.7 .tmp/thin/salt-call -c /home/bruno/dev/setupify --state-output=changes state.sls test
[WARNING ] Although 'dmidecode' was found in path, the current user cannot execute it. Grains output might not be accurate.
[ERROR   ] {'new': '/home/bruno/dev/setupify/symlink'}
local:
----------
          ID: symling_test
    Function: file.symlink
        Name: /home/bruno/dev/setupify/symlink
      Result: False
     Comment: Created new symlink /home/bruno/dev/setupify/symlink -> /home/bruno/dev/setupify/, but was unable to set ownership to root:root
     Started: 16:30:46.619745
    Duration: 10.644 ms
     Changes:   
              ----------
              new:
                  /home/bruno/dev/setupify/symlink

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

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

$ python2.7 .tmp/thin/salt-call -c /home/bruno/dev/setupify  --versions-report
Salt Version:
           Salt: 2016.11.0-11-g47d21d9
 
Dependency Versions:
           cffi: 0.8.6
       cherrypy: 2.3.0
       dateutil: 2.6.0
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   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.12
          PyZMQ: Not Installed
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.4.2
            ZMQ: Not Installed
 
System Versions:
           dist: debian 8.6 
        machine: x86_64
        release: 4.3.0-0.bpo.1-amd64
         system: Linux
        version: debian 8.6
@gtmanfred gtmanfred added the Feature new functionality including changes to functionality and code refactors, etc. label Feb 13, 2017
@gtmanfred gtmanfred added this to the Approved milestone Feb 13, 2017
bbinet added a commit to bbinet/salt that referenced this issue Feb 14, 2017
@stale
Copy link

stale bot commented Sep 6, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature new functionality including changes to functionality and code refactors, etc. stale
Projects
None yet
Development

No branches or pull requests

2 participants