Skip to content

Commit 315cc91

Browse files
author
jtimberman
committed
Note about latest in readme, fix stray package_name
1 parent 5c04522 commit 315cc91

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ A "chef ingredient" is the core package itself, or products or add-on components
4242
- `product_name`: (name attribute) The product name. See the [PRODUCT_MATRIX.md](https://github.com/chef-cookbooks/chef-ingredient/blob/master/PRODUCT_MATRIX.md). For example, `chef-server`, `analytics`, `delivery`, `manage`, etc.
4343
- `ctl_command`: The "ctl" command, e.g., `chef-server-ctl`. This should be automatically detected by the library helper method `chef_ctl_command`, but may need to be specified if something changes, like a new add-on is made available.
4444
- `options`: Options passed to the `package` resource used for installation.
45-
- `version`: Package version, e.g., `12.0.4`. Do not use if specifying `package_source`. Default `nil`.
45+
- `version`: Package version to install. Can be specified in various semver-alike ways: `12.0.4`, `12.0.3-rc.3`, and also `:latest`/`'latest'`. Do not use this property when specifying `package_source`. Default is `:latest`, which will install the latest package from the repository.
4646
- `package_source`: Full path to a location where the package is located. If present, this file is used for installing the package. Default `nil`.
4747
- `timeout`: The amount of time (in seconds) to wait to fetch the installer before timing out. Default: default timeout of the Chef package resource - `900` seconds.
4848

libraries/chef_ingredient_resource.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ChefIngredient < Chef::Resource::LWRPBase
3636

3737
# Attributes for package
3838
attribute :options, kind_of: String
39-
attribute :version, kind_of: [String, Symbol], default: '0.0.0'
39+
attribute :version, kind_of: [String, Symbol], default: :latest
4040
attribute :timeout, kind_of: [Integer, String, NilClass], default: nil
4141
end
4242
end

libraries/helpers.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def chef_ctl_command(product)
2626
end
2727

2828
def version_string(vers)
29-
return '0.0.0' if vers == :latest || vers == 'latest'
29+
return '0.0.0' if vers.to_sym == :latest
3030
vers
3131
end
3232

@@ -78,12 +78,12 @@ def cleanup_old_repo_config
7878
end
7979

8080
def ctl_command
81-
new_resource.ctl_command || chef_ctl_command(new_resource.package_name)
81+
new_resource.ctl_command || chef_ctl_command(new_resource.product_name)
8282
end
8383

8484
def reconfigure
8585
ctl_cmd = ctl_command
86-
execute "#{new_resource.package_name}-reconfigure" do
86+
execute "#{new_resource.product_name}-reconfigure" do
8787
command "#{ctl_cmd} reconfigure"
8888
end
8989
end

0 commit comments

Comments
 (0)