voxpupuli / puppet-rabbitmq

RabbitMQ Puppet Module
http://forge.puppetlabs.com/puppet/rabbitmq
Apache License 2.0
172 stars 502 forks source link

Enabling new plugin fails #566

Closed rmestrum closed 6 years ago

rmestrum commented 7 years ago

When i try to enable a extra plugin, the plugin is enabled bot not running.

When executing the command that the provider uses (/usr/lib/rabbitmq/bin/rabbitmq-plugins) manually an error shows up

[root@rmq ~]# rabbitmq-plugins list
 Configured: E = explicitly enabled; e = implicitly enabled
 | Status:   * = running on rabbit@rmq
 |/
[e*] amqp_client                       3.6.5
[  ] cowboy                            1.0.3
[  ] cowlib                            1.0.1
[e*] mochiweb                          2.13.1
[  ] rabbitmq_amqp1_0                  3.6.5
[  ] rabbitmq_auth_backend_ldap        3.6.5
[  ] rabbitmq_auth_mechanism_ssl       3.6.5
[  ] rabbitmq_consistent_hash_exchange 3.6.5
[  ] rabbitmq_event_exchange           3.6.5
[  ] rabbitmq_federation               3.6.5
[  ] rabbitmq_federation_management    3.6.5
[  ] rabbitmq_jms_topic_exchange       3.6.5
[E*] rabbitmq_management               3.6.5
[e*] rabbitmq_management_agent         3.6.5
[  ] rabbitmq_management_visualiser    3.6.5
[  ] rabbitmq_mqtt                     3.6.5
[  ] rabbitmq_recent_history_exchange  1.2.1
[  ] rabbitmq_sharding                 0.1.0
[  ] rabbitmq_shovel                   3.6.5
[  ] rabbitmq_shovel_management        3.6.5
[  ] rabbitmq_stomp                    3.6.5
[  ] rabbitmq_top                      3.6.5
[  ] rabbitmq_tracing                  3.6.5
[  ] rabbitmq_trust_store              3.6.5
[e*] rabbitmq_web_dispatch             3.6.5
[  ] rabbitmq_web_stomp                3.6.5
[  ] rabbitmq_web_stomp_examples       3.6.5
[  ] sockjs                            0.3.4
[e*] webmachine                        1.10.3
[root@rmq ~]# /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_web_stomp
The following plugins have been enabled:
  rabbitmq_stomp
  cowlib
  cowboy
  sockjs
  rabbitmq_web_stomp

Applying plugin configuration to rabbit@rmq... failed.
 * Could not contact node rabbit@rmq.
   Changes will take effect at broker restart.
 * Options: --online  - fail if broker cannot be contacted.
            --offline - do not try to contact broker.
[root@rmq ~]# /usr/lib/rabbitmq/bin/rabbitmq-plugins list
 Configured: E = explicitly enabled; e = implicitly enabled
 | Status:   [failed to contact rabbit@rmq - status not shown]
 |/
[e ] amqp_client                       3.6.5
[e ] cowboy                            1.0.3
[e ] cowlib                            1.0.1
[e ] mochiweb                          2.13.1
[  ] rabbitmq_amqp1_0                  3.6.5
[  ] rabbitmq_auth_backend_ldap        3.6.5
[  ] rabbitmq_auth_mechanism_ssl       3.6.5
[  ] rabbitmq_consistent_hash_exchange 3.6.5
[  ] rabbitmq_event_exchange           3.6.5
[  ] rabbitmq_federation               3.6.5
[  ] rabbitmq_federation_management    3.6.5
[  ] rabbitmq_jms_topic_exchange       3.6.5
[E ] rabbitmq_management               3.6.5
[e ] rabbitmq_management_agent         3.6.5
[  ] rabbitmq_management_visualiser    3.6.5
[  ] rabbitmq_mqtt                     3.6.5
[  ] rabbitmq_recent_history_exchange  1.2.1
[  ] rabbitmq_sharding                 0.1.0
[  ] rabbitmq_shovel                   3.6.5
[  ] rabbitmq_shovel_management        3.6.5
[e ] rabbitmq_stomp                    3.6.5
[  ] rabbitmq_top                      3.6.5
[  ] rabbitmq_tracing                  3.6.5
[  ] rabbitmq_trust_store              3.6.5
[e ] rabbitmq_web_dispatch             3.6.5
[E ] rabbitmq_web_stomp                3.6.5
[  ] rabbitmq_web_stomp_examples       3.6.5
[e ] sockjs                            0.3.4
[e ] webmachine                        1.10.3
[root@rmq ~]#

The start the plugin i must restart the rabbitmq-server service

When i execute the command that's shown on the site of rabbitmq (rabbitmq-plugins) to enable a plugin the command succeeds and the the plugin is enabled and running without restarting the rabbitmq-server service

[root@rmq ~]# rabbitmq-plugins list
 Configured: E = explicitly enabled; e = implicitly enabled
 | Status:   * = running on rabbit@rmq
 |/
[e*] amqp_client                       3.6.5
[  ] cowboy                            1.0.3
[  ] cowlib                            1.0.1
[e*] mochiweb                          2.13.1
[  ] rabbitmq_amqp1_0                  3.6.5
[  ] rabbitmq_auth_backend_ldap        3.6.5
[  ] rabbitmq_auth_mechanism_ssl       3.6.5
[  ] rabbitmq_consistent_hash_exchange 3.6.5
[  ] rabbitmq_event_exchange           3.6.5
[  ] rabbitmq_federation               3.6.5
[  ] rabbitmq_federation_management    3.6.5
[  ] rabbitmq_jms_topic_exchange       3.6.5
[E*] rabbitmq_management               3.6.5
[e*] rabbitmq_management_agent         3.6.5
[  ] rabbitmq_management_visualiser    3.6.5
[  ] rabbitmq_mqtt                     3.6.5
[  ] rabbitmq_recent_history_exchange  1.2.1
[  ] rabbitmq_sharding                 0.1.0
[  ] rabbitmq_shovel                   3.6.5
[  ] rabbitmq_shovel_management        3.6.5
[  ] rabbitmq_stomp                    3.6.5
[  ] rabbitmq_top                      3.6.5
[  ] rabbitmq_tracing                  3.6.5
[  ] rabbitmq_trust_store              3.6.5
[e*] rabbitmq_web_dispatch             3.6.5
[  ] rabbitmq_web_stomp                3.6.5
[  ] rabbitmq_web_stomp_examples       3.6.5
[  ] sockjs                            0.3.4
[e*] webmachine                        1.10.3
[root@rmq ~]# rabbitmq-plugins enable rabbitmq_web_stomp
The following plugins have been enabled:
  rabbitmq_stomp
  cowlib
  cowboy
  sockjs
  rabbitmq_web_stomp

Applying plugin configuration to rabbit@rmq... started 5 plugins.
[root@rmq ~]# rabbitmq-plugins list
 Configured: E = explicitly enabled; e = implicitly enabled
 | Status:   * = running on rabbit@rmq
 |/
[e*] amqp_client                       3.6.5
[e*] cowboy                            1.0.3
[e*] cowlib                            1.0.1
[e*] mochiweb                          2.13.1
[  ] rabbitmq_amqp1_0                  3.6.5
[  ] rabbitmq_auth_backend_ldap        3.6.5
[  ] rabbitmq_auth_mechanism_ssl       3.6.5
[  ] rabbitmq_consistent_hash_exchange 3.6.5
[  ] rabbitmq_event_exchange           3.6.5
[  ] rabbitmq_federation               3.6.5
[  ] rabbitmq_federation_management    3.6.5
[  ] rabbitmq_jms_topic_exchange       3.6.5
[E*] rabbitmq_management               3.6.5
[e*] rabbitmq_management_agent         3.6.5
[  ] rabbitmq_management_visualiser    3.6.5
[  ] rabbitmq_mqtt                     3.6.5
[  ] rabbitmq_recent_history_exchange  1.2.1
[  ] rabbitmq_sharding                 0.1.0
[  ] rabbitmq_shovel                   3.6.5
[  ] rabbitmq_shovel_management        3.6.5
[e*] rabbitmq_stomp                    3.6.5
[  ] rabbitmq_top                      3.6.5
[  ] rabbitmq_tracing                  3.6.5
[  ] rabbitmq_trust_store              3.6.5
[e*] rabbitmq_web_dispatch             3.6.5
[E*] rabbitmq_web_stomp                3.6.5
[  ] rabbitmq_web_stomp_examples       3.6.5
[e*] sockjs                            0.3.4
[e*] webmachine                        1.10.3

After some investigation is found out that the correct path to the rabbitmq-plugins script should be /usr/sbin/rabbitmq-plugins in stead of /usr/lib/rabbitmq/bin/rabbitmq-plugins

In commit ec5aff0d457e640df780903bd9d64feceb0b0fc2 the path is changed for the Redhat OS

OS: {"name"=>"RedHat", "family"=>"RedHat", "release"=>{"full"=>"6.7", "major"=>"6", "minor"=>"7"}} Rabbitmq: 3.6.5 Erlang: 19.0.4 Puppet: 3.6.2 Rabbitmq module: 5.4.0

wyardley commented 7 years ago

Also odd that the RPM from epel ships two different versions:

[root@centos-7-x64 ~]# sha1sum `which rabbitmq-plugins`
d563b0ff5e629dc242e1f7d6421ac7d8be01cd33  /sbin/rabbitmq-plugins
[root@centos-7-x64 ~]# rpm -qf `which rabbitmq-plugins`
rabbitmq-server-3.3.5-34.el7.noarch
[root@centos-7-x64 ~]# sha1sum /usr/lib/rabbitmq/bin/rabbitmq-plugins 
cbf75da49e85da1e497c5070523e8ad3186846bc  /usr/lib/rabbitmq/bin/rabbitmq-plugins
[root@centos-7-x64 ~]# rpm -qf /usr/lib/rabbitmq/bin/rabbitmq-plugins 
rabbitmq-server-3.3.5-34.el7.noarch

Same seems true with the one from the official repo:

[root@centos-7-x64 tmp]# sha1sum /usr/lib/rabbitmq/bin/rabbitmq-plugins 
cc5c3c9c130ca41dfaa3e721969a4f9367fe0096  /usr/lib/rabbitmq/bin/rabbitmq-plugins
[root@centos-7-x64 tmp]# sha1sum `which rabbitmq-plugins`
49b3a63b4c2a426573f9c0385f1dfab9c8307774  /sbin/rabbitmq-plugins
[root@centos-7-x64 tmp]# rpm -qf /usr/lib/rabbitmq/bin/rabbitmq-plugins 
rabbitmq-server-3.6.11-1.el7.noarch
[root@centos-7-x64 tmp]# rpm -qf `which rabbitmq-plugins`
rabbitmq-server-3.6.11-1.el7.noarch

Both are shell scripts; it seems like the one in /sbin is a shared wrapper used to call various programs in the lib directory. For versions with this setup, I think that one would definitely be preferred.

Reverting https://github.com/voxpupuli/puppet-rabbitmq/commit/ec5aff0d457e640df780903bd9d64feceb0b0fc2 would be easy enough, but maybe the one in /sbin doesn't exist in some versions? I'm not sure if we need to keep the second path as a backup vs. just reverting entirely?

wyardley commented 6 years ago

I updated the fix in #570 and it seems to work even with the old RMQ version on RHEL 6. We'll have to cut another major release for the module soon, so will try to get this included.

Thanks a lot for the detailed report / information.