Tagged "saltstack"

Debugging Saltstack States

利用 Saltstack 安裝 OpenStack Keystone。按照 OpenStack 官方安裝手冊,裝完 Keystone 之後,必須要為 Keystone 自己註冊 service 與 endpoint。

這一個步驟,我把他寫成 Saltstack states 如下:

waiting-keystone-startup:
  cmd.run:
    - name: sleep 1

registry-keystone-service:
  keystone.service_present:
    - name: keystone
    - service_type: identity
    - description: "OpenStack Identity"
    - require:
      - cmd: waiting-keystone-startup

registry-keystone-endpoint:
  keystone.endpoint_present:
    - name: keystone
    - publicurl: http://host-01:5000/v2.0
    - internalurl: http://host-01:5000/v2.0
    - adminurl: http://host-01:35357/v2.0
    - region: regionOne
    - require:
      - keystone: registry-keystone-service

結果執行時發生 KeyError:

user@host-01:/srv/salt/openstack/keystone$ salt '*' state.sls openstack.keystone.registry
host-01:
    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 1161, in _thread_return
        return_data = func(*args, **kwargs)
      File "/usr/lib/python2.7/dist-packages/salt/modules/state.py", line 681, in sls
        ret = st_.state.call_high(high_)
      File "/usr/lib/python2.7/dist-packages/salt/state.py", line 2067, in call_high
        ret = dict(list(disabled.items()) + list(self.call_chunks(chunks).items()))
      File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1623, in call_chunks
        running = self.call_chunk(low, running, chunks)
      File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1769, in call_chunk
        self._mod_init(low)
      File "/usr/lib/python2.7/dist-packages/salt/state.py", line 612, in _mod_init
        self.states['{0}.{1}'.format(low['state'], low['fun'])]  # pylint: disable=W0106
      File "/usr/lib/python2.7/dist-packages/salt/utils/lazy.py", line 90, in __getitem__
        raise KeyError(key)
    KeyError: 'keystone.service_present'

Read more...