Saltstack smtp.send_msg returning with attribute error

210 views
Skip to first unread message

Dale Nelson

unread,
Sep 14, 2017, 9:23:10 PM9/14/17
to Salt-users

I set up a beacon that tracks disk usage on all the Ubuntu Server 16.04 minions on Ubuntu Server 16.04. We wanted a reactor that emails us when disk space reaches a certain point. This question focuses on the master's ability to send an email. When I run the following command on the salt-master:

sudo salt-call smtp.send_msg 'em...@email.com' 'Test message 3' subject='Test subject 3' profile='smtp-default'

I get the following result:

[ERROR   ] An un-handled exception was caught by salt's global exception handler:
AttributeError: 'str' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/bin/salt-call", line 11, in <module>
    salt_call()
  File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 391, in salt_call
    client.run()
  File "/usr/lib/python2.7/dist-packages/salt/cli/call.py", line 58, in run
    caller.run()
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 134, in run
    ret = self.call()
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 204, in call
    ret['return'] = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/modules/smtp.py", line 95, in send_msg
    server = creds.get('smtp.server')
AttributeError: 'str' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/bin/salt-call", line 11, in <module>
    salt_call()
  File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 391, in salt_call
    client.run()
  File "/usr/lib/python2.7/dist-packages/salt/cli/call.py", line 58, in run
    caller.run()
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 134, in run
    ret = self.call()
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 204, in call
    ret['return'] = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/modules/smtp.py", line 95, in send_msg
    server = creds.get('smtp.server')
AttributeError: 'str' object has no attribute 'get'

This is my salt --versions-report output of the master that returns the error:

Salt Version:
           Salt: 2017.7.1

Dependency Versions:
           cffi: 1.10.0
       cherrypy: unknown
       dateutil: 2.4.2
      docker-py: Not Installed
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: 2.18
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         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: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: Ubuntu 16.04 xenial
         locale: UTF-8
        machine: x86_64
        release: 4.4.0-93-generic
         system: Linux
        version: Ubuntu 16.04 xenial

I have uninstalled and reinstalled the salt-master and salt-minion and I have updated Python and the salt-master. I also created another salt-master and it ran into the same problem. What is the fix or solution to this?

Viet Hung Nguyen

unread,
Sep 15, 2017, 6:42:16 PM9/15/17
to Salt-users
You need to configure salt-minion for the default profile or pass the password as argument.
See the doc for more info
https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.smtp.html#module-salt.modules.smtp



--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/132b775d-25e2-4585-8d8b-ae33d2f018fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Thanks & Best regards,
Nguyen Viet Hung (Mr)
[a.k.a HVN]

Mobile: 0982090290

Reply all
Reply to author
Forward
0 new messages