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.find 'exec' breaks the highstate output #41593

Closed
mostafahussein opened this issue Jun 5, 2017 · 3 comments
Closed

file.find 'exec' breaks the highstate output #41593

mostafahussein opened this issue Jun 5, 2017 · 3 comments
Labels
Bug broken, incorrect, or confusing behavior info-needed waiting for more info P4 Priority 4 stale
Milestone

Comments

@mostafahussein
Copy link
Contributor

mostafahussein commented Jun 5, 2017

Description of Issue/Question

When I try to use file.find inside a state in order to copy a file the highstate output breaks becasue of it:
I am using salt-ssh but i believe that would be the case with the normal minion too but i haven't tried it yet.

JSON Render failed for: ['cp', '/usr/local/src/ioncube/ioncube_loader_lin_5.5.so', '/usr/local/php-fpm/lib/php/extensions/no-debug-non-zts-20121212']

The full output:

    ['cp', '/usr/local/src/ioncube/ioncube_loader_lin_5.5.so', '/usr/local/php-fpm/lib/php/extensions/no-debug-non-zts-20121212']
    {
        "local": {
            "fun_args": [
                "/var/tmp/.root_29995b_salt/salt_state.tgz", 
                "test=None", 
                "pkg_sum=ce6f70e504247d1421228a88e8ceaabe7d675cacbb5fa2e76fb07df0a9521899", 
                "hash_type=sha256"
            ], 
            "jid": "20170605204027834597", 
            "return": {
                "module_|-install_ioncube_|-file.find_|-run": {
                    "comment": "Module function file.find executed", 
                    "name": "file.find", 
                    "start_time": "20:40:27.878979", 
                    "result": true, 
                    "duration": 13.108, 
                    "__run_num__": 0, 
                    "changes": {
                        "ret": [
                            "cp /usr/local/src/ioncube/ioncube_loader_lin_5.5.so /usr/local/php-fpm/lib/php/extensions/no-debug-non-zts-20121212:\n\n"
                        ]
                    }, 
                    "__id__": "install_ioncube"
                }
            }, 
            "retcode": 0, 
            "fun": "state.pkg", 
            "id": "remoteserver", 
            "out": "highstate"
        }
    }

Setup

install_ioncube:
  module.run:
    - name: file.find
    - path: /usr/local/php-fpm/lib/php/extensions/
    - kwargs: {name: 'no-debug-non-zts-*', maxdepth: 1, exec: 'cp /usr/local/src/ioncube/ioncube_loader_lin_5.5.so {}'}

I know that if i use bash i would add \ ; to the end of my command but nothing worked. however using the above state makes the file copied correclty to the desired path but the state output thats is my issue

Steps to Reproduce Issue

Try the state above or similar i don't know if the rest of bash commands will be the same or not but my problem when i tried to copy a file

Versions Report

 salt-ssh --versions
Salt Version:
           Salt: 2016.11.5
 
Dependency Versions:
           cffi: 1.9.1
       cherrypy: Not Installed
       dateutil: 2.4.2
      docker-py: Not Installed
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: 0.24.6
        libnacl: 1.4.3
       M2Crypto: 0.21.1
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: 2.17
       pycrypto: 2.6.1
   pycryptodome: 3.4.3
         pygit2: 0.24.2
         Python: 2.7.5 (default, Nov  6 2016, 00:28:07)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: centos 7.3.1611 Core
        machine: x86_64
        release: 3.10.0-514.16.1.el7.x86_64
         system: Linux
        version: CentOS Linux 7.3.1611 Core

@garethgreenaway
Copy link
Contributor

@mostafahussein Thanks for the report. I ran a quick test and it worked using a regular minion setup. Are you able to test your use case like this? Then we can potentially isolate it to an issue with salt-ssh. Thanks!

@garethgreenaway garethgreenaway added this to the Approved milestone Jun 6, 2017
@garethgreenaway garethgreenaway added info-needed waiting for more info Bug broken, incorrect, or confusing behavior P4 Priority 4 labels Jun 6, 2017
@mostafahussein
Copy link
Contributor Author

mostafahussein commented Jun 9, 2017

It works using a regular minion setup correctly:

----------
          ID: copy_file
    Function: module.run
        Name: file.find
      Result: True
     Comment: Module function file.find executed
     Started: 08:17:38.171652
    Duration: 761.407 ms
     Changes:   
              ----------
              ret:
                  - cp /root/lsb_release.sh /tmp/:
                    

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

The issue with salt-ssh only. Which part could be responsible for this ?

@stale
Copy link

stale bot commented Nov 2, 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.

@stale stale bot added the stale label Nov 2, 2018
@stale stale bot closed this as completed Nov 9, 2018
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 info-needed waiting for more info P4 Priority 4 stale
Projects
None yet
Development

No branches or pull requests

2 participants