knife cookbook list | grep artifact
artifact 1.12.2
I am using it in another very simple cookbook
artifact = "/opt/file.zip"
artifact_file artifact do
location "http://192.168.1.71/data/artifacts/lacegant.zip"
owner "root"
group "root"
action :create
end
metadata.rb has, depends 'artifact'
I get below Error on the chef client run,
chef-client --once
Starting Chef Client, version 11.8.2
resolving cookbooks for run list: ["staticsite"]
Synchronizing Cookbooks:
- staticsite
Compiling Cookbooks...
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/staticsite/recipes/default.rb
================================================================================
NameError
---------
Cannot find a resource for artifact_file on ubuntu version 14.04
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/staticsite/recipes/default.rb:9:in `from_file'
Relevant File Content:
----------------------
/var/chef/cache/cookbooks/staticsite/recipes/default.rb:
2: # Cookbook Name:: staticsite
3: # Recipe:: default
4: #
5: # Copyright (c) 2017 The Authors, All Rights Reserved.
6:
7:
8: artifact = "/opt/file.zip"
9>> artifact_file artifact do
10: location "http://192.168.1.71/data/artifacts/lacegant.zip"
11: owner "root"
12: group "root"
13: action :create
14: end 15:
[2017-04-29T16:57:36+00:00] ERROR: Running exception handlers
[2017-04-29T16:57:36+00:00] ERROR: Exception handlers complete
[2017-04-29T16:57:36+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated
[2017-04-29T16:57:36+00:00] ERROR: Cannot find a resource for artifact_file on ubuntu version 14.04
[2017-04-29T16:57:36+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
root@vagrant-ubuntu-trusty-64:/home/vagrant#
2017-04-30T16:25:59+00:00] DEBUG: Initiating GET to https://chefserver.home/organizations/homelab/data/artifact/_default
[2017-04-30T16:25:59+00:00] DEBUG: {"error":["Cannot load data bag item _default for data bag artifact"]}
{"error":["Cannot load data bag item _default for data bag artifact"]}
[2017-04-30T16:25:59+00:00] DEBUG: Initiating GET to https://chefserver.home/organizations/homelab/data/artifact/_wildcard
[2017-04-30T16:25:59+00:00] DEBUG: {"error":["Cannot load data bag item _wildcard for data bag artifact"]}
{"error":["Cannot load data bag item _wildcard for data bag artifact"]}
[2017-04-30T16:25:59+00:00] DEBUG: Initiating GET to https://chefserver.home/organizations/homelab/data/artifact/nexus
[2017-04-30T16:25:59+00:00] DEBUG: {"error":["Cannot load data bag item nexus for data bag artifact"]}
{"error":["Cannot load data bag item nexus for data bag artifact"]}
[2017-04-30T16:25:59+00:00] DEBUG: Loaded contents of /var/chef/cache/cookbooks/artifact/resources/deploy.rb into resource artifact_deploy (Custom resource artifact_deploy from cookbook artifact)
[2017-04-30T16:25:59+00:00] DEBUG: Loading cookbook artifact's resources from /var/chef/cache/cookbooks/artifact/resources/file.rb
[2017-04-30T16:25:59+00:00] DEBUG: Loaded contents of /var/chef/cache/cookbooks/artifact/resources/file.rb into resource artifact_file (Custom resource artifact_file from cookbook artifact)
[2017-04-30T16:25:59+00:00] DEBUG: Loading cookbook artifact's resources from /var/chef/cache/cookbooks/artifact/resources/package.rb
[2017-04-30T16:25:59+00:00] DEBUG: Loaded contents of /var/chef/cache/cookbooks/artifact/resources/package.rb into resource artifact_package (Custom resource artifact_package from cookbook artifact)
[2017-04-30T16:25:59+00:00] DEBUG: Resources for generic artifact_file resource enabled on node include: [Custom resource artifact_file from cookbook artifact]
[2017-04-30T16:25:59+00:00] DEBUG: Resource for artifact_file is Custom resource artifact_file from cookbook artifact
* artifact_file[/tmp/my-artifact.zip] action create[2017-04-30T16:25:59+00:00] INFO: Processing artifact_file[/tmp/my-artifact.zip] action create (staticsite::default line 10)
[2017-04-30T16:25:59+00:00] DEBUG: Providers for generic artifact_file resource enabled on node include: [LWRP provider artifact_file from cookbook artifact]
[2017-04-30T16:25:59+00:00] DEBUG: Provider for action create on resource artifact_file[/tmp/my-artifact.zip] is LWRP provider artifact_file from cookbook artifact
Error executing action `create` on resource 'artifact_file[/tmp/my-artifact.zip]'
/var/chef/cache/cookbooks/artifact/providers/file.rb:48:in `load_current_resource'
10: artifact_file "/tmp/my-artifact.zip" do
11: location "http://192.168.1.71/data/artifacts/lacegant.zip"
artifact_file("/tmp/my-artifact.zip") do
declared_type :artifact_file
location "http://192.168.1.71/data/artifacts/lacegant.zip"
path "/tmp/my-artifact.zip"
[2017-04-30T16:25:59+00:00] DEBUG: Re-raising exception: NameError - artifact_file[/tmp/my-artifact.zip] (staticsite::default line 10) had an error: NameError: uninitialized constant Chef::Resource::ArtifactFile
/var/chef/cache/cookbooks/artifact/providers/file.rb:48:in `load_current_resource'
[2017-04-30T16:25:59+00:00] DEBUG: NameError: artifact_file[/tmp/my-artifact.zip] (staticsite::default line 10) had an error: NameError: uninitialized constant Chef::Resource::ArtifactFile
/var/chef/cache/cookbooks/artifact/providers/file.rb:48:in `load_current_resource'
/var/chef/cache/cookbooks/artifact/providers/file.rb:48:in `load_current_resource'
[2017-04-30T16:25:59+00:00] ERROR: artifact_file[/tmp/my-artifact.zip] (staticsite::default line 10) had an error: NameError: uninitialized constant Chef::Resource::ArtifactFile
Am I missing any dependency or something while using the artifact cookbook ?
As I understand It just doesn’t see the resource artifact_file
Running handlers:
[2017-05-01T13:14:25+00:00] ERROR: Running exception handlers
Running handlers complete
[2017-05-01T13:14:25+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 02 seconds
[2017-05-01T13:14:25+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2017-05-01T13:14:25+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-05-01T13:14:25+00:00] ERROR: artifact_file[artifact.zip] (staticsite::default line 9) had an error: NameError: uninitialized constant Chef::Resource::ArtifactFile
[2017-05-01T13:14:25+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Please consider this issue as closed. I tried the same on “manage.chef.io” it just worked fine.
Seems like some issue with the server I installed locally.