Bug #3113
When importing a manifest puppet needs to chill
| Status: | Closed | Start: | 01/26/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 100% |
|
| Category: | Solaris | |||
| Target version: | 2.6.0 | |||
| Affected version: | 0.25.3 | Branch: | markus:ticket/master/3113 | |
| Keywords: | service | |||
| Votes: | 4 |
Description
When puppet imports a manifest to create a service it needs to wait a while before proceeding, as it will often see the state as “offline*” due to the service is being started when it checks.
This generates an unnecessary error message:
err: //ssh::ops/Service[sshd-pubkey]: Failed to call refresh on Service[sshd-pubkey]: Unmanageable state 'offline*' on service svc:/ops/ssh:default
Associated revisions
Revision 1c5b3d7d4457a7c2e643a3ac160a95f14b347397
Fixes #3113 – When importing a manifest puppet needs to chill
Revision d78282a368165d9de3cf178e64c45732e97fa133
Fixes #3113 – When importing a manifest puppet needs to chill
Revision ae0091d0f9fab4a912728239f0e61d165a8d48d0
Fixes #3113 – When importing a manifest puppet needs to chill
Revision bcd7d65a827d26b7030dfcd851a84a332df47ee9
Fixes #3113 – When importing a manifest puppet needs to chill
Revision acc50b89ff02ff46b9fee28817f76af0cc3dd417
Fixes #3113 – When importing a manifest puppet needs to chill
Revision c0746d5510772daf04b403963556f22325239a66
Fixes #3113 – When importing a manifest puppet needs to chill
Revision 3ea8b226d819f2c71419ef42a8fa2c112d986e63
Fixes #3113 – When importing a manifest puppet needs to chill
Revision f24f6dc71ce6410bcb55032d3aa9c8a8b0682e4a
Fixes #3113 – When importing a manifest puppet needs to chill
Revision 74cd55fbda7edf64b6bbd77143ea3f1fbdf39e30
Fixes #3113 – When importing a manifest puppet needs to chill
History
Updated by Markus Roberts 7 months ago
A few questions:
- Is this a change from 0.24.x?
- Rather than time based (“wait awhile”) should it be “wait for completion”?
- Can you give context / a simple case to demonstrate the problem?
- Is the real issue that svcs is returning “offline*” (with a trailing star) and the smf provider isn’t recognizing this as it would “offline”?
— Markus
Updated by Markus Roberts 7 months ago
- Status changed from Unreviewed to Needs more information
Updated by Martin Englund 7 months ago
- File dummy.xml added
A few answers :) * It has always been this way, I’ve just not gotten around to file the bug until now * Waiting for completion could be dangerous, as the import + enable could cause a very long wait (defined in the timeout in the service manifest) * I’ve attached a service manifest which will take 30 seconds to start * Yes it returns “offline*” with a trailing star when the state is in transition.
If you run the query as
svcs -o state,nstate fmriyou get the desired end state too, so if it (the end state) is the desired state (online in most cases), it should assume it is going to be successful and continue.
E.g.
root@uk-lp-1 # svccfg import dummy.xml root@uk-lp-1 # svcs dummy STATE STIME FMRI offline* 8:23:18 svc:/dummy:default root@uk-lp-1 # svcs -o state,nstate dummy STATE NSTATE offline online
Updated by Markus Roberts 7 months ago
- Status changed from Needs more information to Investigating
Updated by Martin Englund 7 months ago
Try this fix: http://github.com/pmenglund/puppet/commit/5f25a5cd4bb742cc626f995b158fb1e2cf193750:
diff --git a/lib/puppet/provider/service/smf.rb b/lib/puppet/provider/service/smf.rb
index 0071a8c..e7510d3 100755
--- a/lib/puppet/provider/service/smf.rb
+++ b/lib/puppet/provider/service/smf.rb
@@ -70,7 +70,10 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
end
begin
- state = svcs("-H", "-o", "state", @resource[:name]).chomp
+ # get the current state and the next state, and if the next
+ # state is set (i.e. not "-") use it for state comparison
+ states = svcs("-H", "-o", "state,nstate", @resource[:name]).chomp
+ state = states[1] == "-" ? states[0] : states[1]
rescue Puppet::ExecutionFailure
info "Could not get status on service %s" % self.name
return :stopped
Updated by Nobuchika Tanaka 7 months ago
Hi, Markus and Martin.
I also have same trouble on this topic. I checked a patch made by Martin, but this didn’t work well.
messages file shows:
Jan 29 11:48:26 kousagi puppetd[2837]: [ID 702911 daemon.notice] triggered run Jan 29 11:48:28 kousagi puppetd[2837]: [ID 702911 daemon.error] (//Service[autofs]) Failed to retrieve current state of resource: Unmanageable state '110' on service autofs Jan 29 11:48:28 kousagi puppetd[2837]: [ID 702911 daemon.warning] Value of 'preferred_serialization_format' (pson) is invalid for report, using default (b64_zlib_yaml) Jan 29 11:48:28 kousagi puppetd[2837]: [ID 702911 daemon.notice] Finished catalog run in 0.59 seconds
Do you have any idea?
Updated by Martin Englund 7 months ago
That is strange! I’ll take a look and will produce another patch today.
Can you paste the output of the command: svcs -H -o state,nstate autofs
Updated by Martin Englund 7 months ago
Ah, it helps if I commit the changes from the right system. It was missing a “split” a the end.
Try this diff, it should work better…
diff --git a/lib/puppet/provider/service/smf.rb b/lib/puppet/provider/service/smf.rb
index e7510d3..f7f3a31 100755
--- a/lib/puppet/provider/service/smf.rb
+++ b/lib/puppet/provider/service/smf.rb
@@ -72,7 +72,7 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
begin
# get the current state and the next state, and if the next
# state is set (i.e. not "-") use it for state comparison
- states = svcs("-H", "-o", "state,nstate", @resource[:name]).chomp
+ states = svcs("-H", "-o", "state,nstate", @resource[:name]).chomp.split
state = states[1] == "-" ? states[0] : states[1]
rescue Puppet::ExecutionFailure
info "Could not get status on service %s" % self.name
Updated by Nobuchika Tanaka 7 months ago
I checked a new patch you made, it works well!
messages file shows:
Feb 1 09:52:58 kousagi puppetd[2015]: [ID 702911 daemon.notice] triggered run Feb 1 09:53:03 kousagi puppetd[2015]: [ID 702911 daemon.notice] (//Service[autofs]/ensure) ensure changed 'running' to 'stopped' Feb 1 09:53:03 kousagi puppetd[2015]: [ID 702911 daemon.notice] Finished catalog run in 3.11 seconds
Updated by James Turnbull 7 months ago
- Status changed from Investigating to Accepted
- Target version set to 0.25.5
Updated by James Turnbull 5 months ago
- Status changed from Accepted to Ready for Testing
Updated by James Turnbull 5 months ago
Pushed in commit:“74cd55fbda7edf64b6bbd77143ea3f1fbdf39e30” in branch 0.25.x
Updated by James Turnbull 5 months ago
- Status changed from Ready for Testing to Closed
- % Done changed from 0 to 100
Applied in changeset commit:“74cd55fbda7edf64b6bbd77143ea3f1fbdf39e30”.
Updated by James Turnbull 5 months ago
- Status changed from Closed to Ready for Testing
Updated by Markus Roberts 5 months ago
- Branch set to markus:ticket/master/3113
Updated by Markus Roberts 5 months ago
- Status changed from Ready for Testing to Available In Testing Branch
Updated by James Turnbull 5 months ago
- Target version changed from 0.25.5 to 2.6.0
Updated by Markus Roberts 4 months ago
- Status changed from Available In Testing Branch to Closed
Pushed as commit:“1c5b3d7d4457a7c2e643a3ac160a95f14b347397” in master.