Skip to content

Instantly share code, notes, and snippets.

@gerl1ng
Created February 13, 2015 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerl1ng/a6e1eee9a35669572272 to your computer and use it in GitHub Desktop.
Save gerl1ng/a6e1eee9a35669572272 to your computer and use it in GitHub Desktop.
Saltstack: AttributeError: 'NoneType' object has no attribute 'extend'
include:
- services.mariadb
{% if grains['os'] == 'Ubuntu' %}
extend:
mariadb-server:
service:
- require:
file: /etc/mysql/my.cnf
/etc/mysql/my.cnf:
file:
- managed
- user: root
- group: root
- mode: 644
- source: salt://application1/database/my.cnf_ubuntu
- watch:
- pkg: mariadb-server
{% endif %}
mysql_python:
pkg:
{% if grains['os'] == 'Ubuntu' %}
- name: python-mysqldb
{% else %}
- name: MySQL-python
{% endif %}
- installed
mysql-connector-python:
pkg:
{% if grains['os'] == 'Ubuntu' %}
- name: python-mysql.connector
{% else %}
- name: mysql-connector-python
{% endif %}
- installed
wordpress_database:
mysql_database.present:
- name: wordpress_prod
access_localhost:
mysql_user.present:
- name: wordpress
- password: wordpress
- host: 'localhost'
- require:
- service: mariadb-server
mysql_grants.present:
- database: wordpress_prod.*
- grant: ALL PRIVILEGES
- user: wordpress
- host: 'localhost'
- require:
- service: mariadb-server
access_minion2:
mysql_user.present:
- name: wordpress
- password: wordpress
- host: 'minion2'
- require:
- service: mariadb-server
mysql_grants.present:
- database: wordpress_prod.*
- grant: ALL PRIVILEGES
- user: wordpress
- host: 'minion2'
- require:
- service: mariadb-server
access_minion4:
mysql_user.present:
- name: wordpress
- password: wordpress
- host: 'minion4'
- require:
- service: mariadb-server
mysql_grants.present:
- database: wordpress_prod.*
- grant: ALL PRIVILEGES
- user: wordpress
- host: 'minion4'
- require:
- service: mariadb-server
root@minion3:~# uname -a
Linux minion3 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
root@minion3:~# salt-call --version
salt-call 2014.7.1 (Helium)
root@minion3:~# salt-call -l debug state.highstate
[DEBUG ] Reading configuration from /etc/salt/minion
[DEBUG ] Using cached minion ID from /etc/salt/minion_id: minion3
[DEBUG ] Configuration file path: /etc/salt/minion
[DEBUG ] Reading configuration from /etc/salt/minion
[DEBUG ] Decrypting the current master AES key
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG ] Mako not available
[DEBUG ] Decrypting the current master AES key
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG ] Reading configuration from /etc/salt/minion
[DEBUG ] Decrypting the current master AES key
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[INFO ] Loading fresh modules for state activity
[INFO ] Fetching file from saltenv 'base', ** skipped ** latest already in cache 'salt://top.sls'
[DEBUG ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG ] Rendered data from file: /var/cache/salt/minion/files/base/top.sls:
base:
'*':
- default
'minion1':
- application1.proxy
'minion[24]':
- application1.webserver
'minion3':
- application1.database
[DEBUG ] Results of YAML rendering:
OrderedDict([('base', OrderedDict([('*', ['default']), ('minion1', ['application1.proxy']), ('minion[24]', ['application1.webserver']), ('minion3', ['application1.database'])]))])
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG ] Syncing all
[INFO ] Creating module dir '/var/cache/salt/minion/extmods/modules'
[INFO ] Syncing modules for environment 'base'
[INFO ] Loading cache from salt://_modules, for base)
[DEBUG ] Decrypting the current master AES key
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[INFO ] Caching directory '_modules/' for environment 'base'
[DEBUG ] Local cache dir: '/var/cache/salt/minion/files/base/_modules'
[INFO ] Creating module dir '/var/cache/salt/minion/extmods/states'
[INFO ] Syncing states for environment 'base'
[INFO ] Loading cache from salt://_states, for base)
[INFO ] Caching directory '_states/' for environment 'base'
[DEBUG ] Local cache dir: '/var/cache/salt/minion/files/base/_states'
[INFO ] Creating module dir '/var/cache/salt/minion/extmods/grains'
[INFO ] Syncing grains for environment 'base'
[INFO ] Loading cache from salt://_grains, for base)
[INFO ] Caching directory '_grains/' for environment 'base'
[DEBUG ] Local cache dir: '/var/cache/salt/minion/files/base/_grains'
[INFO ] Creating module dir '/var/cache/salt/minion/extmods/renderers'
[INFO ] Syncing renderers for environment 'base'
[INFO ] Loading cache from salt://_renderers, for base)
[INFO ] Caching directory '_renderers/' for environment 'base'
[DEBUG ] Local cache dir: '/var/cache/salt/minion/files/base/_renderers'
[INFO ] Creating module dir '/var/cache/salt/minion/extmods/returners'
[INFO ] Syncing returners for environment 'base'
[INFO ] Loading cache from salt://_returners, for base)
[INFO ] Caching directory '_returners/' for environment 'base'
[DEBUG ] Local cache dir: '/var/cache/salt/minion/files/base/_returners'
[INFO ] Creating module dir '/var/cache/salt/minion/extmods/outputters'
[INFO ] Syncing outputters for environment 'base'
[INFO ] Loading cache from salt://_outputters, for base)
[INFO ] Caching directory '_outputters/' for environment 'base'
[DEBUG ] Local cache dir: '/var/cache/salt/minion/files/base/_outputters'
[INFO ] Creating module dir '/var/cache/salt/minion/extmods/utils'
[INFO ] Syncing utils for environment 'base'
[INFO ] Loading cache from salt://_utils, for base)
[INFO ] Caching directory '_utils/' for environment 'base'
[DEBUG ] Local cache dir: '/var/cache/salt/minion/files/base/_utils'
[DEBUG ] Refreshing modules...
[INFO ] Loading fresh modules for state activity
[DEBUG ] SaltEvent PUB socket URI: ipc:///var/run/salt/minion/minion_event_373d963849_pub.ipc
[DEBUG ] SaltEvent PULL socket URI: ipc:///var/run/salt/minion/minion_event_373d963849_pull.ipc
[DEBUG ] Sending event - data = {'_stamp': '2015-02-13T13:26:29.267657'}
[INFO ] Fetching file from saltenv 'base', ** skipped ** latest already in cache 'salt://default.sls'
[DEBUG ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG ] Rendered data from file: /var/cache/salt/minion/files/base/default.sls:
include:
- packages.git
- packages.htop
- packages.openssh
- services.openssh-server
- packages.tmux
[DEBUG ] Results of YAML rendering:
OrderedDict([('include', ['packages.git', 'packages.htop', 'packages.openssh', 'services.openssh-server', 'packages.tmux'])])
[INFO ] Fetching file from saltenv 'base', ** skipped ** latest already in cache 'salt://packages/git.sls'
[DEBUG ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG ] Rendered data from file: /var/cache/salt/minion/files/base/packages/git.sls:
git:
pkg:
- latest
[DEBUG ] Results of YAML rendering:
OrderedDict([('git', OrderedDict([('pkg', ['latest'])]))])
[INFO ] Fetching file from saltenv 'base', ** skipped ** latest already in cache 'salt://packages/htop.sls'
[DEBUG ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG ] Rendered data from file: /var/cache/salt/minion/files/base/packages/htop.sls:
htop:
pkg:
- latest
[DEBUG ] Results of YAML rendering:
OrderedDict([('htop', OrderedDict([('pkg', ['latest'])]))])
[INFO ] Fetching file from saltenv 'base', ** skipped ** latest already in cache 'salt://packages/openssh.sls'
[DEBUG ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG ] Rendered data from file: /var/cache/salt/minion/files/base/packages/openssh.sls:
openssh:
pkg:
- name: openssh-client
- latest
[DEBUG ] Results of YAML rendering:
OrderedDict([('openssh', OrderedDict([('pkg', [OrderedDict([('name', 'openssh-client')]), 'latest'])]))])
[INFO ] Fetching file from saltenv 'base', ** skipped ** latest already in cache 'salt://services/openssh-server.sls'
[DEBUG ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG ] Rendered data from file: /var/cache/salt/minion/files/base/services/openssh-server.sls:
include:
- packages.openssh-server
extend:
openssh-server:
service:
- name: ssh
- running
- require:
- pkg: openssh-server
[DEBUG ] Results of YAML rendering:
OrderedDict([('include', ['packages.openssh-server']), ('extend', OrderedDict([('openssh-server', OrderedDict([('service', [OrderedDict([('name', 'ssh')]), 'running', OrderedDict([('require', [OrderedDict([('pkg', 'openssh-server')])])])])]))]))])
[INFO ] Fetching file from saltenv 'base', ** skipped ** latest already in cache 'salt://packages/openssh-server.sls'
[DEBUG ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG ] Rendered data from file: /var/cache/salt/minion/files/base/packages/openssh-server.sls:
openssh-server:
pkg:
- latest
[DEBUG ] Results of YAML rendering:
OrderedDict([('openssh-server', OrderedDict([('pkg', ['latest'])]))])
[INFO ] Fetching file from saltenv 'base', ** skipped ** latest already in cache 'salt://packages/tmux.sls'
[DEBUG ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG ] Rendered data from file: /var/cache/salt/minion/files/base/packages/tmux.sls:
tmux:
pkg:
- latest
[DEBUG ] Results of YAML rendering:
OrderedDict([('tmux', OrderedDict([('pkg', ['latest'])]))])
[DEBUG ] Fetching file from saltenv 'base', ** attempting ** 'salt://application1/database.sls'
[INFO ] Fetching file from saltenv 'base', ** skipped ** latest already in cache 'salt://application1/database/init.sls'
[DEBUG ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG ] Rendered data from file: /var/cache/salt/minion/files/base/application1/database/init.sls:
include:
- services.mariadb
extend:
mariadb-server:
service:
- require:
file: /etc/mysql/my.cnf
/etc/mysql/my.cnf:
file:
- managed
- user: root
- group: root
- mode: 644
- source: salt://application1/database/my.cnf_ubuntu
- watch:
- pkg: mariadb-server
mysql_python:
pkg:
- name: python-mysqldb
- installed
mysql-connector-python:
pkg:
- name: python-mysql.connector
- installed
wordpress_database:
mysql_database.present:
- name: wordpress_prod
access_localhost:
mysql_user.present:
- name: wordpress
- password: wordpress
- host: 'localhost'
- require:
- service: mariadb-server
mysql_grants.present:
- database: wordpress_prod.*
- grant: ALL PRIVILEGES
- user: wordpress
- host: 'localhost'
- require:
- service: mariadb-server
access_minion2:
mysql_user.present:
- name: wordpress
- password: wordpress
- host: 'minion2'
- require:
- service: mariadb-server
mysql_grants.present:
- database: wordpress_prod.*
- grant: ALL PRIVILEGES
- user: wordpress
- host: 'minion2'
- require:
- service: mariadb-server
access_minion4:
mysql_user.present:
- name: wordpress
- password: wordpress
- host: 'minion4'
- require:
- service: mariadb-server
mysql_grants.present:
- database: wordpress_prod.*
- grant: ALL PRIVILEGES
- user: wordpress
- host: 'minion4'
- require:
- service: mariadb-server
[DEBUG ] Results of YAML rendering:
OrderedDict([('include', ['services.mariadb']), ('extend', OrderedDict([('mariadb-server', OrderedDict([('service', [OrderedDict([('require', None), ('file', '/etc/mysql/my.cnf')])])]))])), ('/etc/mysql/my.cnf', OrderedDict([('file', ['managed', OrderedDict([('user', 'root')]), OrderedDict([('group', 'root')]), OrderedDict([('mode', 644)]), OrderedDict([('source', 'salt://application1/database/my.cnf_ubuntu')]), OrderedDict([('watch', [OrderedDict([('pkg', 'mariadb-server')])])])])])), ('mysql_python', OrderedDict([('pkg', [OrderedDict([('name', 'python-mysqldb')]), 'installed'])])), ('mysql-connector-python', OrderedDict([('pkg', [OrderedDict([('name', 'python-mysql.connector')]), 'installed'])])), ('wordpress_database', OrderedDict([('mysql_database.present', [OrderedDict([('name', 'wordpress_prod')])])])), ('access_localhost', OrderedDict([('mysql_user.present', [OrderedDict([('name', 'wordpress')]), OrderedDict([('password', 'wordpress')]), OrderedDict([('host', 'localhost')]), OrderedDict([('require', [OrderedDict([('service', 'mariadb-server')])])])]), ('mysql_grants.present', [OrderedDict([('database', 'wordpress_prod.*')]), OrderedDict([('grant', 'ALL PRIVILEGES')]), OrderedDict([('user', 'wordpress')]), OrderedDict([('host', 'localhost')]), OrderedDict([('require', [OrderedDict([('service', 'mariadb-server')])])])])])), ('access_minion2', OrderedDict([('mysql_user.present', [OrderedDict([('name', 'wordpress')]), OrderedDict([('password', 'wordpress')]), OrderedDict([('host', 'minion2')]), OrderedDict([('require', [OrderedDict([('service', 'mariadb-server')])])])]), ('mysql_grants.present', [OrderedDict([('database', 'wordpress_prod.*')]), OrderedDict([('grant', 'ALL PRIVILEGES')]), OrderedDict([('user', 'wordpress')]), OrderedDict([('host', 'minion2')]), OrderedDict([('require', [OrderedDict([('service', 'mariadb-server')])])])])])), ('access_minion4', OrderedDict([('mysql_user.present', [OrderedDict([('name', 'wordpress')]), OrderedDict([('password', 'wordpress')]), OrderedDict([('host', 'minion4')]), OrderedDict([('require', [OrderedDict([('service', 'mariadb-server')])])])]), ('mysql_grants.present', [OrderedDict([('database', 'wordpress_prod.*')]), OrderedDict([('grant', 'ALL PRIVILEGES')]), OrderedDict([('user', 'wordpress')]), OrderedDict([('host', 'minion4')]), OrderedDict([('require', [OrderedDict([('service', 'mariadb-server')])])])])]))])
[INFO ] Fetching file from saltenv 'base', ** skipped ** latest already in cache 'salt://services/mariadb.sls'
[DEBUG ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG ] Rendered data from file: /var/cache/salt/minion/files/base/services/mariadb.sls:
include:
- packages.mariadb
extend:
mariadb-server:
service:
- name: mysql
- running
- require:
- pkg: mariadb-server
[DEBUG ] Results of YAML rendering:
OrderedDict([('include', ['packages.mariadb']), ('extend', OrderedDict([('mariadb-server', OrderedDict([('service', [OrderedDict([('name', 'mysql')]), 'running', OrderedDict([('require', [OrderedDict([('pkg', 'mariadb-server')])])])])]))]))])
[INFO ] Fetching file from saltenv 'base', ** skipped ** latest already in cache 'salt://packages/mariadb.sls'
[DEBUG ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG ] Rendered data from file: /var/cache/salt/minion/files/base/packages/mariadb.sls:
include:
- packages.mariadb-client
mariadb-server:
pkg:
- name: mysql-server
- latest
[DEBUG ] Results of YAML rendering:
OrderedDict([('include', ['packages.mariadb-client']), ('mariadb-server', OrderedDict([('pkg', [OrderedDict([('name', 'mysql-server')]), 'latest'])]))])
[INFO ] Fetching file from saltenv 'base', ** skipped ** latest already in cache 'salt://packages/mariadb-client.sls'
[DEBUG ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG ] Rendered data from file: /var/cache/salt/minion/files/base/packages/mariadb-client.sls:
mariadb-client:
pkg:
- name: mysql-client
- latest
[DEBUG ] Results of YAML rendering:
OrderedDict([('mariadb-client', OrderedDict([('pkg', [OrderedDict([('name', 'mysql-client')]), 'latest'])]))])
[ERROR ] An un-handled exception was caught by salt's global exception handler:
AttributeError: 'NoneType' object has no attribute 'extend'
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 123, in salt_call
client.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/__init__.py", line 420, in run
caller.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 225, in run
ret = self.call()
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 129, in call
ret['return'] = func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/state.py", line 325, in highstate
whitelist=kwargs.get('whitelist')
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 2883, in call_highstate
return self.state.call_high(high)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1983, in call_high
high, ext_errors = self.reconcile_extend(high)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1175, in reconcile_extend
(high[name][state][hind][argfirst]
AttributeError: 'NoneType' object has no attribute 'extend'
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 123, in salt_call
client.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/__init__.py", line 420, in run
caller.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 225, in run
ret = self.call()
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 129, in call
ret['return'] = func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/state.py", line 325, in highstate
whitelist=kwargs.get('whitelist')
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 2883, in call_highstate
return self.state.call_high(high)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1983, in call_high
high, ext_errors = self.reconcile_extend(high)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1175, in reconcile_extend
(high[name][state][hind][argfirst]
AttributeError: 'NoneType' object has no attribute 'extend'
include:
- packages.mariadb-client
mariadb-server:
pkg:
{% if grains['os'] == 'Ubuntu' %}
- name: mysql-server
{% endif %}
- latest
mariadb-client:
pkg:
{% if grains['os'] == 'Ubuntu' %}
- name: mysql-client
{% else %}
- name: mariadb
{% endif %}
- latest
include:
- packages.mariadb
extend:
mariadb-server:
service:
{% if grains['os'] == 'Ubuntu' %}
- name: mysql
{% else %}
- name: mariadb
{% endif %}
- running
- require:
- pkg: mariadb-server
base:
'*':
- default
'minion1':
- application1.proxy
'minion[24]':
- application1.webserver
'minion3':
- application1.database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment