-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add accept_license property to chef-ingredient. #101
Conversation
# | ||
def license_acceptance_parameter | ||
if new_resource.accept_license && | ||
(new_resource.product_name == 'compliance' && version_for(new_resource.version) >= version_for('1.1.3')) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for checking the version 👍
Hrmmm... Looks like there is one wrinkle for this. Do we pass the I can see two options:
I am leaning more towards option 1 since it is a simpler case. If you see the reconfigure error (which has a clear error message) you add this option. There are complicated scenarios like what if you are on a previous version of chef-ingredient, what if you are using a custom repo and did not populate your local repositories with the version that supports this CLI option, etc... Let me know what you think guys and I'll change the PR. |
Code looks good - I would also lean towards the first (simpler) option, as long as the error message is clear and there's a simple path a user can go to fix it. Looks like travis is unhappy but otherwise 👍 |
(new_resource.product_name == 'manage' && version_for(new_resource.version) >= version_for('1.10.0')) || | ||
(new_resource.product_name == 'reporting' && version_for(new_resource.version) >= version_for('1.6.0')) || | ||
(new_resource.product_name == 'analytics' && version_for(new_resource.version) >= version_for('1.4.0')) | ||
'--accept_license' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So IMO we should just lay down the required /var/opt/<PROJECT>/.license.accepted
if accept_license
is true. This will allow us to avoid all this crazy version checking and is fully backward compatible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 to Seth's comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea. Will do that.
f61fa5f
to
fc84a25
Compare
Updated with @schisamo's great comment! |
@@ -57,6 +57,7 @@ By default, `chef_ingredient` will install using the `packages.chef.io` stable r | |||
- `channel`: Channel to install the products from. It can be `:stable` (default), `:current` or `:unstable`. | |||
- `package_source`: Full path to a location where the package is located. If present, this file is used for installing the package. Default `nil`. | |||
- `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. | |||
- `accept_license`: A boolean value that specifies if license should be accepted if it is asked for during `reconfigure`action. This option is needed only for manage, analytics, reporting and manage products. Default: `false`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
manage, analytics, reporting and manage
Something is strange in that sentence. I believe we are missing a few products also like Compliance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
argh... double manage 😄 will fix soon.
fc84a25
to
f5d9fe6
Compare
Great work guys. I've tried this against ================================================================================
Error executing action `reconfigure` on resource 'chef_ingredient[compliance]'
================================================================================
Chef::Exceptions::EnclosingDirectoryDoesNotExist
------------------------------------------------
file[/var/opt/chef-compliance/.license.accepted] (/tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/chef_ingredient_provider.rb line 94) had an error: Chef::Exceptions::EnclosingDirectoryDoesNotExist: Parent directory /var/opt/chef-compliance does not exist. Creating the |
@alexpop you are awesome. Fixing it immediately. |
Thanks to @alexpop for verifying this change for compliance. |
👍 |
As we start releasing addons and other packages to include the license accept feature I anticipate that a good portion of the integration tests will start to fail. |
…ker kitchen file. Proprietary Chef products—such as Chef Compliance, Chef Delivery, Chef Analytics, Reporting, and the Chef Management Console—are governed by the Chef MLSA. [The Chef MLSA must be accepted when installing or reconfiguring the product](https://docs.chef.io/chef_license.html). Chef ingredient added the [accept_license](chef-cookbooks/chef-ingredient#101) property to provide a way to automate this. This fix adds the attribute ['chef-server']['accept_license']. The default value is _false_. Individuals must explicitly change the value to true in their environment to accept the license. Make sure you set the node attribute ['chef-server']['accept_license'] = true to resolve this error.
This PR add
accept_license
property to chef-ingredient so the users can set it to be able to reconfigure compliance, manage, reporting and analytics after the version that supports--accept-license
during reconfigure ships.@mmzyk note that this PR needs the minimum version numbers that support
--accept-license
CLI option. I have set them to be a minor version bump with the current existing ones. If we would like to set a different version let me know./cc: @chef-cookbooks/engineering-services @alexpop