Skip to content
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

Use declare_resource for local package install #40

Merged
merged 2 commits into from
Sep 13, 2015

Conversation

jtimberman
Copy link
Contributor

Per this comment:

chef/chef#3487 (comment)

We should not use the provider property of resources. We should instead use the DSL method, #declare_resource. This commit converts the definition to use that method.

@lamont-granquist
Copy link

👍

@jtimberman jtimberman force-pushed the jtimberman/use-declare-resource branch from e96a2d3 to 31513c0 Compare July 3, 2015 06:27
@jtimberman
Copy link
Contributor Author

Urgh. Don't know why the specs are failing in Travis. They pass on my local system.

% rspec spec -fd --color

chef-splunk::client
  creates the local system directory
  creates an outputs template in the local system directory
  notifies the splunk service to restart when rendering the outputs template
  inputs config has hosts
    creates an inputs template in the local system directory if it has hosts
    notifies the splunk service to restart when rendering the inputs template

chef-splunk::disabled
  splunk is disabled
    stops the splunk service
    uninstalls the splunk package
    uninstalls the splunkforwarder package
    disables splunk startup at boot

chef-splunk::install_forwarder
  debian family
    caches the package with remote_file
    installs the package with the downloaded file
  redhat family
    caches the package with remote_file
    installs the package with the downloaded file
  omnios family
    caches the package with remote_file
    uncompresses the package file
    writes out the nocheck file
    writes out the response file
    installs the package with the downloaded file

chef-splunk::install_server
  debian family
    caches the package with remote_file
    installs the package with the downloaded file
  redhat family
    caches the package with remote_file
    installs the package with the downloaded file
  omnios family
    caches the package with remote_file
    uncompresses the package file
    writes out the nocheck file
    writes out the response file
    installs the package with the downloaded file

chef-splunk::service
  enables the service at boot and accepts the license
  starts the splunk service

chef-splunk::setup_ssl
  default attribute settings
[2015-07-03T00:15:55-06:00] WARN: chef_gem[chef-vault] chef_gem compile_time installation is deprecated
[2015-07-03T00:15:55-06:00] WARN: chef_gem[chef-vault] Please set `compile_time false` on the resource to use the new behavior.
[2015-07-03T00:15:55-06:00] WARN: chef_gem[chef-vault] or set `compile_time true` on the resource if compile_time behavior is required.
WARN: Unresolved specs during Gem::Specification.reset:
      nokogiri (>= 1.4.0, ~> 1.5)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
    includes chef-vault
[2015-07-03T00:15:56-06:00] WARN: chef_gem[chef-vault] chef_gem compile_time installation is deprecated
[2015-07-03T00:15:56-06:00] WARN: chef_gem[chef-vault] Please set `compile_time false` on the resource to use the new behavior.
[2015-07-03T00:15:56-06:00] WARN: chef_gem[chef-vault] or set `compile_time true` on the resource if compile_time behavior is required.
    writes web.conf with http port 443
[2015-07-03T00:15:58-06:00] WARN: chef_gem[chef-vault] chef_gem compile_time installation is deprecated
[2015-07-03T00:15:58-06:00] WARN: chef_gem[chef-vault] Please set `compile_time false` on the resource to use the new behavior.
[2015-07-03T00:15:58-06:00] WARN: chef_gem[chef-vault] or set `compile_time true` on the resource if compile_time behavior is required.
    enables SSL in the web.conf file
[2015-07-03T00:15:59-06:00] WARN: chef_gem[chef-vault] chef_gem compile_time installation is deprecated
[2015-07-03T00:15:59-06:00] WARN: chef_gem[chef-vault] Please set `compile_time false` on the resource to use the new behavior.
[2015-07-03T00:15:59-06:00] WARN: chef_gem[chef-vault] or set `compile_time true` on the resource if compile_time behavior is required.
    writes the SSL key from the chef-vault data bag item
[2015-07-03T00:16:00-06:00] WARN: chef_gem[chef-vault] chef_gem compile_time installation is deprecated
[2015-07-03T00:16:00-06:00] WARN: chef_gem[chef-vault] Please set `compile_time false` on the resource to use the new behavior.
[2015-07-03T00:16:00-06:00] WARN: chef_gem[chef-vault] or set `compile_time true` on the resource if compile_time behavior is required.
    writes the SSL certificate from the chef-vault data bag item
  alternative webui port
[2015-07-03T00:16:01-06:00] WARN: chef_gem[chef-vault] chef_gem compile_time installation is deprecated
[2015-07-03T00:16:01-06:00] WARN: chef_gem[chef-vault] Please set `compile_time false` on the resource to use the new behavior.
[2015-07-03T00:16:01-06:00] WARN: chef_gem[chef-vault] or set `compile_time true` on the resource if compile_time behavior is required.
    writes web.conf with a non-default port for https

chef-splunk::upgrade
  stops splunk with a special service resource
  downloads the package to install
  installs the package with splunk_installer
  runs an unattended upgrade (starts splunk)

chef-splunk::user
  os linux
    creates a splunk group with the defaults from attributes
    creates a splunk user with the defaults from attributes
  os non-linux
    creates a splunk group that does not have system true
    creates a splunk user that does not have system true

Finished in 1 minute 5.69 seconds (files took 6.67 seconds to load)
43 examples, 0 failures

@lamont-granquist
Copy link

they don't seem to have anything to do with this change.

@jtimberman jtimberman self-assigned this Jul 4, 2015
@rarsan
Copy link
Contributor

rarsan commented Jul 17, 2015

From the build failure:

================================================================================
Recipe Compile Error in /tmp/d20150703-26336-kxh9mb/cookbooks/chef-splunk/recipes/setup_ssl.rb
================================================================================
Net::HTTPServerException
------------------------
404 "Not Found "

Cookbook Trace:
---------------
  /tmp/d20150703-26336-kxh9mb/cookbooks/chef-vault/libraries/chef_vault_item.rb:33:in `chef_vault_item'
  /tmp/d20150703-26336-kxh9mb/cookbooks/chef-splunk/recipes/setup_ssl.rb:29:in `from_file'

The current stubbing for load on Chef::DataBagItem 'splunk_certificates' in setup_ssl_spec does not work anymore after this change:
chef-boneyard/chef-vault@9622929
As you can see, helper method chef_vault_item is now first doing a check by calling load on Chef::DataBag directly, hence the 404 while attempting to fetch non-existent 'vault' data bag.

A workaround is obviously to stub Chef::DataBag load in addition to Chef::DataBagItem load.

I think another slightly better alternative is to mock the data bag instead of being dependent on internal implementation of chef_vault_item: I just submitted corresponding PR #45 which should fix the build.

jtimberman added 2 commits September 13, 2015 09:58
Per this comment:

chef/chef#3487 (comment)

We should not use the `provider` property of resources. We should
instead use the DSL method, #declare_resource. This commit converts the
definition to use that method.
@jtimberman jtimberman force-pushed the jtimberman/use-declare-resource branch from 31513c0 to 35a85c6 Compare September 13, 2015 16:00
jtimberman added a commit that referenced this pull request Sep 13, 2015
…ource

Use declare_resource for local package install
@jtimberman jtimberman merged commit 68601d2 into master Sep 13, 2015
@jtimberman jtimberman deleted the jtimberman/use-declare-resource branch September 13, 2015 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants