[815] Resolve circular dependency when using sensu::enterprise::dashboard::api #816
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See issue #815 on Github for more details. Previously, when declaring the sensu
class along with an instance of the sensu::enterprise::dashboard::api defined
type, a circular dependency was raised by Puppet. This was caused because
first, the sensu::enterprise::dashboard::api defined type declares an instance
of the sensu_enterprise_dashboard_api_config type, and the
sensu_enterprise_dashboard_api_config type contains, within the initialize
method, contains an automatic "notify" on the "sensu-enterprise-dashboard" service (i.e.
Service['sensu-enterprise-dashboard']). The sensu::enterprise::dashboard::api
defined type also uses the require function on the sensu::enterprise::dashboard
class, which sets a 'require' dependency on every resource within the class.
Because Service['sensu-enterprise-dashboard'] is located within the
sensu::enterprise::dashboard class, that means that
Service['sensu-enterprise-dashboard'] contains a circular dependency on any
instance of the sensu::enterprise::dashboard::api defined type.
To resolve the circular dependency, this commit changes the require function
within the sensu::enterprise::dashboard::api defined type to
the include function which eliminates the 'require' dependency.
I tested this change out with vagrant and was able to get JSON back from the
API, but I'd prefer someone with greater Sensu Enterprise knowledge to validate
and ensure that converting 'require' to 'include' didn't upset any existing
dependencies.