salt icon indicating copy to clipboard operation
salt copied to clipboard

'defaults.merge' is not available when using `salt-ssh`

Open myii opened this issue 5 years ago • 6 comments

Description of Issue/Question

SaltStack-Formulas has started to adopt using defaults.merge in map.jinja, for example in the salt-formula.

There are now two reports that this isn't working when using salt-ssh. Both with the same error:

  • https://github.com/saltstack-formulas/redis-formula/issues/75#issuecomment-459667105
  • https://github.com/saltstack-formulas/openssh-formula/pull/151#issuecomment-462866903
[DEBUG   ] Could not LazyLoad defaults.merge: 'defaults.merge' is not available.

This is an unfortunate development, since we're making a concerted effort to improve the quality and usefulness of SaltStack-Formulas in general. For reference:

  • https://github.com/orgs/saltstack-formulas/projects/1
  • https://github.com/saltstack-formulas/template-formula/issues/21

Setup

The redis-formula issue has full details.

Steps to Reproduce Issue

Covered in the issue above.

Versions Report

Covered in the issue above. Also supplied in the openssh-formula pull comment.

myii avatar Feb 12 '19 18:02 myii

looks like i'm able to replicate this error running the following:

  1. cd /srv/salt
  2. git clone https://github.com/saltstack-formulas/redis-formula.git .
  3. salt-ssh '*' state.sls redis test=True -ltrace > /tmp/test 2>&1

and i see - Rendering SLS 'base:redis.common' failed: Jinja variable 'dict object' has no attribute 'pkg_name'

looks like we need to get this fixed up thanks

Ch3LL avatar Feb 13 '19 16:02 Ch3LL

@Ch3LL Thanks for the review and confirmation.

and i see - Rendering SLS 'base:redis.common' failed: Jinja variable 'dict object' has no attribute 'pkg_name'

Yes, as a symptom of the merge not taking place, the other YAML files are not merged into the map, leading to missing attributes as shown in the following two comments:

  • https://github.com/saltstack-formulas/redis-formula/issues/75#issuecomment-459279282
  • https://github.com/saltstack-formulas/redis-formula/issues/75#issuecomment-459281665

myii avatar Feb 13 '19 18:02 myii

For anyone stumbling on this: You can use slsutil.merge to do exactly the same thing.

yuriks avatar Mar 20 '20 08:03 yuriks

@yuriks Thanks for sharing that. Actually, we've got an active PR that proposes the same thing:

  • https://github.com/saltstack-formulas/template-formula/pull/186

myii avatar Mar 20 '20 08:03 myii

@yuriks looks like slsutil.merge isn't working in the salt-ssh situation too

vincentor avatar Apr 29 '20 03:04 vincentor

just got bit by this as well.

nergdron avatar Jul 26 '22 17:07 nergdron