{"action":"created","issue":{"url":"https://api.github.com/repos/puppetlabs/puppet/issues/3790","labels_url":"https://api.github.com/repos/puppetlabs/puppet/issues/3790/labels{/name}","comments_url":"https://api.github.com/repos/puppetlabs/puppet/issues/3790/comments","events_url":"https://api.github.com/repos/puppetlabs/puppet/issues/3790/events","html_url":"https://github.com/puppetlabs/puppet/pull/3790","id":66765683,"number":3790,"title":"(PUP-2455) Update service provider to use 'ctrun' on Solaris","user":{"login":"geoffnichols","id":2007978,"avatar_url":"https://avatars.githubusercontent.com/u/2007978?v=3","gravatar_id":"","url":"https://api.github.com/users/geoffnichols","html_url":"https://github.com/geoffnichols","followers_url":"https://api.github.com/users/geoffnichols/followers","following_url":"https://api.github.com/users/geoffnichols/following{/other_user}","gists_url":"https://api.github.com/users/geoffnichols/gists{/gist_id}","starred_url":"https://api.github.com/users/geoffnichols/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoffnichols/subscriptions","organizations_url":"https://api.github.com/users/geoffnichols/orgs","repos_url":"https://api.github.com/users/geoffnichols/repos","events_url":"https://api.github.com/users/geoffnichols/events{/privacy}","received_events_url":"https://api.github.com/users/geoffnichols/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/puppetlabs/puppet/labels/PL","name":"PL","color":"d4c5f9"},{"url":"https://api.github.com/repos/puppetlabs/puppet/labels/Unix","name":"Unix","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-04-07T03:36:50Z","updated_at":"2015-04-08T06:28:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/puppetlabs/puppet/pulls/3790","html_url":"https://github.com/puppetlabs/puppet/pull/3790","diff_url":"https://github.com/puppetlabs/puppet/pull/3790.diff","patch_url":"https://github.com/puppetlabs/puppet/pull/3790.patch"},"body":"Prior to this commit, non-SMF Puppet-managed services on Solaris\r\nare not started in their own SMF contracts. If started\r\nby Puppet running as a daemon, the services end up in Puppet's\r\nSMF contract.\r\n\r\nThere are several negative implications from this scenario:\r\n\r\n(1) If Puppet is stopped or restarted, the non-SMF Puppet-managed\r\nservices in Puppet's SMF contract are killed (by SMF).\r\n\r\n(2) If Puppet-managed services are in Puppet's SMF contract, certain\r\nevents impacting any one of the managed services can lead to SMF killing\r\nkilling Puppet's contract, also killing all Puppet-managed services\r\nthat have ended up in Puppet's SMF contract.\r\n\r\nIn both scenarios, SMF also places Puppet in the SMF \"maintenance\"\r\nstate.\r\n\r\nThis commit updates the Puppet service provider to use the Solaris\r\n'ctrun' facility to start Puppet-managed services in their own\r\nSMF contracts.\r\n\r\nWe also add an acceptance test and update spec tests to accomodate\r\nuse of :osfamily in the texecute method override."},"comment":{"url":"https://api.github.com/repos/puppetlabs/puppet/issues/comments/90819035","html_url":"https://github.com/puppetlabs/puppet/pull/3790#issuecomment-90819035","issue_url":"https://api.github.com/repos/puppetlabs/puppet/issues/3790","id":90819035,"user":{"login":"geoffnichols","id":2007978,"avatar_url":"https://avatars.githubusercontent.com/u/2007978?v=3","gravatar_id":"","url":"https://api.github.com/users/geoffnichols","html_url":"https://github.com/geoffnichols","followers_url":"https://api.github.com/users/geoffnichols/followers","following_url":"https://api.github.com/users/geoffnichols/following{/other_user}","gists_url":"https://api.github.com/users/geoffnichols/gists{/gist_id}","starred_url":"https://api.github.com/users/geoffnichols/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoffnichols/subscriptions","organizations_url":"https://api.github.com/users/geoffnichols/orgs","repos_url":"https://api.github.com/users/geoffnichols/repos","events_url":"https://api.github.com/users/geoffnichols/events{/privacy}","received_events_url":"https://api.github.com/users/geoffnichols/received_events","type":"User","site_admin":false},"created_at":"2015-04-08T06:28:17Z","updated_at":"2015-04-08T06:28:17Z","body":"@haus Yes, thanks. \r\n\r\n I'm struggling a bit with with the spec test.\r\n\r\nI added this to ```spec/unit/provider/service/init_spec.rb```:\r\n\r\n```\r\ndescribe \"when starting a service on Solaris\" do\r\n  it \"should use ctrun\" do\r\n    Facter.stubs(:value).with(:osfamily).returns 'Solaris'\r\n    provider.expects(:texecute).with(:start, ['/usr/bin/ctrun -l none', '/service/path/myservice', :start], true).returns(\"\")\r\n    provider.start\r\n  end\r\nend\r\n```\r\nWhen I execute, I'm seeing this error:\r\n\r\n```\r\n# be rspec spec/unit/provider/service/init_spec.rb\r\nRun options: exclude {:broken=>true, :benchmark=>true}\r\n..................................F\r\n\r\nFailures:\r\n\r\n  1) Puppet::Type::Service::ProviderInit if the init script is present when starting a service on Solaris should use ctrun\r\n     Failure/Error: provider.start\r\n     Mocha::ExpectationError:\r\n       unexpected invocation: Service[myservice](provider=init).texecute(:start, ['/service/path/myservice', :start], true)\r\n       unsatisfied expectations:\r\n       - expected exactly once, not yet invoked: Service[myservice](provider=init).texecute(:start, ['/usr/bin/ctrun -l none', '/service/path/myservice', :start], true)\r\n       satisfied expectations:\r\n       - allowed any number of times, not yet invoked: Signal.trap(any_parameters)\r\n       - allowed any number of times, invoked once: File.directory?('/alt/service/path')\r\n       - allowed any number of times, invoked once: File.directory?('/service/path')\r\n       - allowed any number of times, invoked once: Puppet::FileSystem.exist?('/service/path/myservice')\r\n       - allowed any number of times, not yet invoked: Facter.value(:osfamily)\r\n     # ./lib/puppet/provider/service/service.rb:39:in `ucommand'\r\n     # ./lib/puppet/provider/service/base.rb:65:in `start'\r\n     # ./spec/unit/provider/service/init_spec.rb:216:in `block (4 levels) in <top (required)>'\r\n\r\nFinished in 0.1179 seconds\r\n35 examples, 1 failure\r\n\r\n```\r\nSince we're overriding ```texecute``` based on the Facter returning \"Solaris\" for ```osfamily```,  it seems like ```allowed any number of times, not yet invoked: Facter.value(:osfamily)``` may be part of the issue."}}