Salt: [salt-ssh] saltutil.sync_modules corrupts the extracted thin directory on target system

Created on 6 Dec 2016  路  5Comments  路  Source: saltstack/salt

I'm reopening the issue we discovered in #37580 with a minimal reproducer. \cc @isbm

Setup

  • on the 1st system: salt-master, salt-ssh in version 2016.3.4 or 2015.8.7
  • on the 2nd system: sshd configured & running

Steps to reproduce:

On the 1st system:

  1. File roots base /srv/salt:
    Relevant portion of master config:
file_roots:
  base:
    - /srv/salt/
  1. Roster
myhost:
  host: myhostfqdn
  user: root
  passwod: mypass
  1. Create a custom module in /srv/salt/_modules/mymodule.py with the following contents:
# -*- coding: utf-8 -*-
from __future__ import absolute_import

import logging
import salt.modules.cmdmod

__salt__ = {
    'cmd.run_all': salt.modules.cmdmod.run_all,
}

log = logging.getLogger(__name__)

def __virtual__():
    return True

def get_me_stuff():
    result = {"status": "ok"}
    return result
  1. Create a state using the module above in /srv/salt/my/state.sls
state:
  module.run:
      - name: mymodule.get_me_stuff
  1. Proceed as follows (on the "master")
  2. salt-ssh -i myhost state.apply my.state -> succeeds
  3. salt-ssh -i myhost saltutil.sync_modules -> empty output
  4. salt-ssh -i myhost state.apply my.state -> fails now

The last command fails, until we delete the extracted thin in the temp of the
target system (-w parameter as suggested in the older issue doesn't help). After the 1st command execution, the mymodule.py is present in extracted thin on the target system, but running sync_modules deletes it and it's not copied again by running the last state.apply.

Versions report

Salt Version:
Salt: 2016.3.4

Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
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.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.7.12 (default, Jun 28 2016, 06:57:42) [GCC]
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.2

System Versions:
dist: SuSE 42.2 x86_64
machine: x86_64
release: 4.1.34-33-default
system: Linux
version: openSUSE 42.2 x86_64

Bug Core P4 Salt-SSH severity-high stale

Most helpful comment

@Ch3LL I will look at this.

All 5 comments

This is a bug. While sync_modules has zero sense on Salt SSH, as there are nothing to sync with, yet it should no-op. Otherwise you would need to do endless if/else in your templates.

We should fix this for sure.

However, for now do not use sync_modules. :laughing:

Looks like I am able to replicate this. We should definitely get this fixed up. As @isbm explained we don't need to use sync_modules but definitely should not be having issues when running the module.

@Ch3LL I will look at this.

@Ch3LL could you please assign me here?

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.

Was this page helpful?
0 / 5 - 0 ratings