-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(PUP-10102) fix service crash #7794
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
CLA signed by all contributors. |
@@ -53,7 +53,6 @@ def defpath | |||
break | |||
end | |||
end | |||
raise "Could not find the daemon directory (tested [/var/lib/service,/etc])" unless @defpath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we could confine the provider based on the existence on one of the daemon directories, so that the framework never calls the unsuitable provider. Something like:
confine :exists => defpath
And then change defpath
to:
def self.defpath
["/var/lib/service", "/etc"].find do |path|
Puppet::FileSystem.exist?(path) && FileTest.directory?(path)
end
end
If we can't confine based on those directories (see the init provider's comment), then I think we should check for defpath
returning nil, otherwise we'll call FileTest.directory?(nil)
which happens to be nil-safe. Suggest checking for nil explicitly:
def self.instances
path = self.defpath
unless path
Puppet.info("daemontools is unsuitable because service directory is nil")
end
...
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no other confines on defpath
so i opt on using the second options as i do not have enough context on why the confine on defpath is problematic. Having the attr_writer :defpath
means that @defpath
can be set from different places.
When running on distributions that do not have a default service provider puppet will try to evaluate `runit` and set `defpath` default before verifying that `runit` is suitable. Raising an error when setting defpath results in a state that should not be reached. This commit removes the raise exception from defpath and let puppet decide if the provide is suitable or not.
The first version led to this error for me running unit tests in debian docker containers:
in spec_helper.rb |
@TheMeier that is a syntax error, make sure that the content of |
There is still an issue because if the |
That is freshly installed via gem every time in the docker container. So it's quite strange and I don't understand where it comes from... |
@TheMeier could you try to apply https://patch-diff.githubusercontent.com/raw/puppetlabs/puppet/pull/7794.patch after the regular gem install? |
@gimmyxd I will try tomorrow |
D'oh got an explanation for the syntax error. Seems gitlab-ci caches led to me applying my monkey patches twice .. :/ |
@gimmyxd the patch works fine. I have to validate the the issues we were having are not related to gitlab-ci caching in the first place |
Without the patch and with cache disabled the error also occurs. So I am somewhat confident to say this patch fixes my issues |
When running on distributions that do not have a
default service provider puppet will try to
evaluate
runit
and setdefpath
defaultbefore verifying that
runit
is suitable. Raising anerror when setting defpath results in a state that should
not be reached.
This commit removes the raise exception from defpath
and let puppet decide if the provide is suitable or not.