Skip to content

Commit

Permalink
chore(clean): remove requires from config clean states
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Jul 8, 2021
1 parent f9ef575 commit 29f8ea7
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 38 deletions.
2 changes: 1 addition & 1 deletion docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ This state will configure the rabbitmq service and has a dependency on ``rabbitm
via include list. It excludes ``rabbitmq.config.cluster`` state

``rabbitmq.config.cluster``
^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^

For initial setup this state writes the erlang cookie, joins cluster, and restarts service. The erlang cookie comes from pillar data and must the identical for all cluster members. Join fails if cluster is inconsistent (see rabbitmqctl forget_cluster_node rabbit@somehost).

Expand Down
1 change: 1 addition & 0 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ suites:
'*':
- rabbitmq._mapdata
- states.files
- rabbitmq.clean
- rabbitmq
pillars:
top.sls:
Expand Down
6 changes: 0 additions & 6 deletions rabbitmq/config/plugin/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %}
{%- set sls_service_running = tplroot ~ '.service.running' %}
include:
- {{ sls_service_running }}
{%- if 'plugin' in rabbitmq and rabbitmq.plugin is mapping %}
{%- for name in rabbitmq.plugin %}
Expand All @@ -15,8 +11,6 @@ rabbitmq-config-plugin-disabled-{{ name }}:
rabbitmq_plugin.disabled:
- name: {{ name }}
- runas: {{ rabbitmq.plugin[name]['runas'] }}
- watch_in:
- sls: {{ sls_package_clean }}
{%- endfor %}
{%- endif %}
6 changes: 0 additions & 6 deletions rabbitmq/config/policy/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@

{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %}
{%- set sls_package_clean = tplroot ~ '.package.clean' %}
include:
- {{ sls_package_clean }}
{% for name in rabbitmq.policy %}
rabbitmq-config-policy-absent-{{ name }}:
rabbitmq_policy.absent:
- name: {{ name }}
- onlyif: test -x {{ rabbitmq.dir.base }}/bin/rabbitmq-env
- require_in:
- sls: {{ sls_package_clean }}
{% endfor %}
6 changes: 0 additions & 6 deletions rabbitmq/config/queue/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@

{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %}
{%- set sls_service_running = tplroot ~ '.service.running' %}
include:
- {{ sls_service_running }}
{% for name, q in salt["pillar.get"]("rabbitmq:queue", {}).items() %}
rabbitmq-config-queue-absent-{{ name }}:
cmd.run:
- name: /usr/local/sbin/rabbitmqadmin delete queue --vhost={{ q.vhost }} --username={{ q.user }} --password={{ q.passwd }} name={{ name }} # noqa 204
- require:
- service: rabbitmq-service-running-service-running
{% endfor %}
6 changes: 0 additions & 6 deletions rabbitmq/config/upstream/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@

{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %}
{%- set sls_package_clean = tplroot ~ '.package.clean' %}
include:
- {{ sls_package_clean }}
{% for name in rabbitmq.upstream %}
rabbitmq-config-upstream-absent-{{ name }}:
rabbitmq_upstream.absent:
- name: {{ name }}
- require_in:
- sls: {{ sls_package_clean }}
{% endfor %}
6 changes: 0 additions & 6 deletions rabbitmq/config/user/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@

{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %}
{%- set sls_package_clean = tplroot ~ '.package.clean' %}
include:
- {{ sls_package_clean }}
{% for name, user in salt["pillar.get"]("rabbitmq:user", {}).items() %}
rabbitmq-config-user-absent-{{ name }}:
rabbitmq_user.absent:
- name: {{ name }}
- onlyif: test -x {{ rabbitmq.dir.base }}/bin/rabbitmq-env
- require_in:
- sls: {{ sls_package_clean }}
{% endfor %}
6 changes: 0 additions & 6 deletions rabbitmq/config/vhost/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@

{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %}
{%- set sls_package_clean = tplroot ~ '.package.clean' %}
include:
- {{ sls_package_clean }}
{% for name in rabbitmq.vhost %}
rabbitmq-config-vhost-absent-{{ name }}:
rabbitmq_vhost.absent:
- name: {{ name }}
- onlyif: test -x {{ rabbitmq.dir.base }}/bin/rabbitmq-env
- require_in:
- sls: {{ sls_package_clean }}
{% endfor %}
2 changes: 2 additions & 0 deletions rabbitmq/service/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ rabbitmq-service-clean-service-dead:
- name: {{ rabbitmq.service.name }}
- enable: False
- sig: 'rabbit boot'
- require_in:
- sls: {{ sls_package_clean }}
3 changes: 2 additions & 1 deletion test/integration/default/controls/services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
service_name = 'rabbitmq-server'

describe service(service_name) do
it { should be_enabled }
it { should be_installed }
# it { should be_enabled }
it { should be_running }
end
end

0 comments on commit 29f8ea7

Please sign in to comment.