Skip to content

Commit 05cc069

Browse files
GiedriusSGiedrius Statkevičius
authored andcommitted
manifests/plugin: reorder plugin notify
In some rare cases Puppet starts to think that we are redefining the elasticsearch_plugin entity when it is used before the actual resource declaration and then applying the catalog fails: Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Override, Could not autoload puppet/type/elasticsearch_plugin: Attempt to redefine entity 'http://puppet.com/2016.1/runtime/type/elasticsearch_plugin'. Set at unknown location at /etc/puppetlabs/code/environments/main/modules/elasticsearch/manifests/plugin.pp:94:5 at /etc/puppetlabs/code/environments/main/core/profiles/manifests/foo/elasticsearch.pp:104 on node foo.bar.540455029edf40888d96132b81ff8db7f1d553bc This output is from the older plugin version but it happens with the newer one as well since the same code block exists in both versions.Reordering and putting the notify block after declaring the resource fixes this problem.
1 parent 68cb9fb commit 05cc069

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

manifests/plugin.pp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,6 @@
9090
default: { }
9191
}
9292

93-
if ! empty($instances) and $elasticsearch::restart_plugin_change {
94-
Elasticsearch_plugin[$name] {
95-
notify +> Elasticsearch::Instance[$instances],
96-
}
97-
}
98-
9993
# set proxy by override or parse and use proxy_url from
10094
# elasticsearch::proxy_url or use no proxy at all
10195

@@ -149,4 +143,10 @@
149143
recurse => true,
150144
before => $_file_before,
151145
}
146+
147+
if ! empty($instances) and $elasticsearch::restart_plugin_change {
148+
Elasticsearch_plugin[$name] {
149+
notify +> Elasticsearch::Instance[$instances],
150+
}
151+
}
152152
}

0 commit comments

Comments
 (0)