Update old removed Chef syntax in Vagrant provision
The original reported issue was due to the deprecation and removal of `Chef::Platform.set`. This was fixed by moving to the new provider syntax. Other changes in the Chef cookbooks were performed to address similar changes due to deprecated and removed methods and models as well as to conform to new enforcements. One issue not addressed in this change is to make the Oracle JDK download work, since Java 8u20 is no longer available. This fix was tested with the following override in the Vagrantfile: java: { install_flavor: 'openjdk', jdk_version: 7 } The above change is NOT included in this patch set. Further work would be necessary to update the Oracle download before `vagrant up` will work without this modification. Fix #1123 Signed-off-by: Steve Lewis <steven.lewis@cambiahealth.com>
This commit is contained in:
parent
5f29e4fbf3
commit
c6a7c52c8c
|
@ -19,7 +19,12 @@
|
|||
|
||||
# default jdk attributes
|
||||
default['java']['jdk_version'] = '6'
|
||||
default['java']['arch'] = kernel['machine'] =~ /x86_64/ ? "x86_64" : "i586"
|
||||
default['java']['arch'] = if node['kernel']['machine'].match?(/x86_64/)
|
||||
"x86_64"
|
||||
else
|
||||
"i586"
|
||||
end
|
||||
#default['java']['arch'] = kernel['machine'] =~ /x86_64/ ?
|
||||
default['java']['openjdk_packages'] = []
|
||||
default['java']['openjdk_version'] = nil
|
||||
default['java']['accept_license_agreement'] = false
|
||||
|
|
|
@ -114,7 +114,7 @@ class Chef
|
|||
end
|
||||
|
||||
def platform_requires_license_acceptance?
|
||||
%w(smartos).include?(node.platform)
|
||||
%w(smartos).include?(node['platform_family'])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,30 +1,29 @@
|
|||
# provider mappings
|
||||
|
||||
# client
|
||||
Chef::Platform.set :platform => :debian, :resource => :mysql_client, :provider => Chef::Provider::MysqlClient::Debian
|
||||
Chef::Platform.set :platform => :fedora, :resource => :mysql_client, :provider => Chef::Provider::MysqlClient::Fedora
|
||||
Chef::Platform.set :platform => :freebsd, :resource => :mysql_client, :provider => Chef::Provider::MysqlClient::FreeBSD
|
||||
Chef::Platform.set :platform => :omnios, :resource => :mysql_client, :provider => Chef::Provider::MysqlClient::Omnios
|
||||
Chef::Platform.set :platform => :rhel, :resource => :mysql_client, :provider => Chef::Provider::MysqlClient::Rhel
|
||||
Chef::Platform.set :platform => :amazon, :resource => :mysql_client, :provider => Chef::Provider::MysqlClient::Rhel
|
||||
Chef::Platform.set :platform => :redhat, :resource => :mysql_client, :provider => Chef::Provider::MysqlClient::Rhel
|
||||
Chef::Platform.set :platform => :centos, :resource => :mysql_client, :provider => Chef::Provider::MysqlClient::Rhel
|
||||
Chef::Platform.set :platform => :oracle, :resource => :mysql_client, :provider => Chef::Provider::MysqlClient::Rhel
|
||||
Chef::Platform.set :platform => :scientific, :resource => :mysql_client, :provider => Chef::Provider::MysqlClient::Rhel
|
||||
Chef::Platform.set :platform => :smartos, :resource => :mysql_client, :provider => Chef::Provider::MysqlClient::Smartos
|
||||
Chef::Platform.set :platform => :suse, :resource => :mysql_client, :provider => Chef::Provider::MysqlClient::Suse
|
||||
Chef::Platform.set :platform => :ubuntu, :resource => :mysql_client, :provider => Chef::Provider::MysqlClient::Ubuntu
|
||||
Chef::Provider::MysqlClient::Debian.provides :mysql_client, platform: "debian"
|
||||
Chef::Provider::MysqlClient::Fedora.provides :mysql_client, platform: "fedora"
|
||||
Chef::Provider::MysqlClient::FreeBSD.provides :mysql_client, platform: "freebsd"
|
||||
Chef::Provider::MysqlClient::Omnios.provides :mysql_client, platform: "omnios"
|
||||
Chef::Provider::MysqlClient::Rhel.provides :mysql_client, platform: "amazon"
|
||||
Chef::Provider::MysqlClient::Rhel.provides :mysql_client, platform: "redhat"
|
||||
Chef::Provider::MysqlClient::Rhel.provides :mysql_client, platform: "centos"
|
||||
Chef::Provider::MysqlClient::Rhel.provides :mysql_client, platform: "oracle"
|
||||
Chef::Provider::MysqlClient::Rhel.provides :mysql_client, platform: "scientific"
|
||||
Chef::Provider::MysqlClient::Smartos.provides :mysql_client, platform: "smartos"
|
||||
Chef::Provider::MysqlClient::Suse.provides :mysql_client, platform: "suse"
|
||||
Chef::Provider::MysqlClient::Ubuntu.provides :mysql_client, platform: "ubuntu"
|
||||
|
||||
# service
|
||||
Chef::Platform.set :platform => :debian, :resource => :mysql_service, :provider => Chef::Provider::MysqlService::Debian
|
||||
Chef::Platform.set :platform => :fedora, :resource => :mysql_service, :provider => Chef::Provider::MysqlService::Fedora
|
||||
Chef::Platform.set :platform => :freebsd, :resource => :mysql_service, :provider => Chef::Provider::MysqlService::FreeBSD
|
||||
Chef::Platform.set :platform => :omnios, :resource => :mysql_service, :provider => Chef::Provider::MysqlService::Omnios
|
||||
Chef::Platform.set :platform => :amazon, :resource => :mysql_service, :provider => Chef::Provider::MysqlService::Rhel
|
||||
Chef::Platform.set :platform => :redhat, :resource => :mysql_service, :provider => Chef::Provider::MysqlService::Rhel
|
||||
Chef::Platform.set :platform => :centos, :resource => :mysql_service, :provider => Chef::Provider::MysqlService::Rhel
|
||||
Chef::Platform.set :platform => :oracle, :resource => :mysql_service, :provider => Chef::Provider::MysqlService::Rhel
|
||||
Chef::Platform.set :platform => :scientific, :resource => :mysql_service, :provider => Chef::Provider::MysqlService::Rhel
|
||||
Chef::Platform.set :platform => :smartos, :resource => :mysql_service, :provider => Chef::Provider::MysqlService::Smartos
|
||||
Chef::Platform.set :platform => :suse, :resource => :mysql_service, :provider => Chef::Provider::MysqlService::Suse
|
||||
Chef::Platform.set :platform => :ubuntu, :resource => :mysql_service, :provider => Chef::Provider::MysqlService::Ubuntu
|
||||
Chef::Provider::MysqlService::Debian.provides :mysql_service, platform: "debian"
|
||||
Chef::Provider::MysqlService::Fedora.provides :mysql_service, platform: "fedora"
|
||||
Chef::Provider::MysqlService::FreeBSD.provides :mysql_service, platform: "freebsd"
|
||||
Chef::Provider::MysqlService::Omnios.provides :mysql_service, platform: "omnios"
|
||||
Chef::Provider::MysqlService::Rhel.provides :mysql_service, platform: "amazon"
|
||||
Chef::Provider::MysqlService::Rhel.provides :mysql_service, platform: "redhat"
|
||||
Chef::Provider::MysqlService::Rhel.provides :mysql_service, platform: "centos"
|
||||
Chef::Provider::MysqlService::Rhel.provides :mysql_service, platform: "oracle"
|
||||
Chef::Provider::MysqlService::Rhel.provides :mysql_service, platform: "scientific"
|
||||
Chef::Provider::MysqlService::Smartos.provides :mysql_service, platform: "smartos"
|
||||
Chef::Provider::MysqlService::Suse.provides :mysql_service, platform: "suse"
|
||||
Chef::Provider::MysqlService::Ubuntu.provides :mysql_service, platform: "ubuntu"
|
||||
|
|
|
@ -40,7 +40,7 @@ Most often this will be used to generate a secure password for an attribute. In
|
|||
|
||||
```ruby
|
||||
::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
|
||||
node.set_unless[:my_password] = secure_password
|
||||
node.default_unless[:my_password] = secure_password
|
||||
```
|
||||
|
||||
To use the `openssl::upgrade` recipe, set the attributes as mentioned above. For example, we have a "stats_collector" service that uses openssl. It has a recipe that looks like this:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "openssl",
|
||||
"version": "2.0.0",
|
||||
"description": "Provides a library with a method for generating secure random passwords.",
|
||||
"long_description": "openssl Cookbook\n================\n\nThis cookbook provides a library method to generate secure random passwords in recipes using the Ruby OpenSSL library.\n\nIt also provides an attribute-driven recipe for upgrading OpenSSL packages.\n\nRequirements\n------------\n\nThe `secure_password` works on any platform with OpenSSL Ruby bindings installed, which are a requirement for Chef anyway.\n\nThe upgrade recipe works on the following tested platforms:\n\n* Ubuntu 12.04, 14.04\n* Debian 7.4\n* CentOS 6.5\n\nIt may work on other platforms or versions of the above platforms with or without modification.\n\n[Chef Sugar](https://github.com/sethvargo/chef-sugar) was introduced as a dependency to provide helpers that make the default attribute settings (see Attributes) easier to reason about.\n\nAttributes\n----------\n\n* `node['openssl']['packages']` - An array of packages of openssl. The default attributes attempt to be smart about which packages are the default, but this may need to be changed by users of the `openssl::upgrade` recipe.\n* `node['openssl']['restart_services']` - An array of service resources that use the `node['openssl']['packages']`. This is empty by default as Chef has no reliably reasonable way to detect which applications or services are compiled against these packages. *Note* These each need to be \"`service`\" resources specified somewhere in the recipes in the node's run list.\n\nRecipes\n-------\n\n### upgrade\n\nThe upgrade recipe iterates over the list of packages in the `node['openssl']['packages']` attribute and manages them with the `:upgrade` action. Each package will send `:restart` notification to service resources named by the `node['openssl']['restart_services']` attribute.\n\nUsage\n-----\n\nMost often this will be used to generate a secure password for an attribute. In a recipe:\n\n```ruby\n::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)\nnode.set_unless[:my_password] = secure_password\n```\n\nTo use the `openssl::upgrade` recipe, set the attributes as mentioned above. For example, we have a \"stats_collector\" service that uses openssl. It has a recipe that looks like this:\n\nLWRP\n==== \n\nThis cookbook includes an LWRP for generating Self Signed Certificates\n\n## openssl_x509\ngenerate a pem formatted x509 cert + key \n\n### Attributes\n`common_name` A String representing the `CN` ssl field\n`org` A String representing the `O` ssl field\n`org_unit` A String representing the `OU` ssl field\n`country` A String representing the `C` ssl field\n`expire` A Fixnum reprenting the number of days from _now_ to expire the cert\n`key_file` Optional A string to the key file to use. If no key is present it will generate and store one. \n`key_pass` A String that is the key's passphrase\n`key_length` A Fixnum reprenting your desired Bit Length _Default: 2048_\n`owner` The owner of the files _Default: \"root\"_\n`group` The group of the files _Default: \"root\"_\n`mode` The mode to store the files in _Default: \"0400\"_\n\n### Example usage\n\n openssl_x509 \"/tmp/mycert.pem\" do\n common_name \"www.f00bar.com\"\n org \"Foo Bar\"\n org_unit \"Lab\"\n country \"US\"\n end\n\n \nLicense and Author\n==================\n\nAuthor:: Jesse Nelson (<spheromak@gmail.com>)\nAuthor:: Joshua Timberman (<joshua@opscode.com>)\n=======\n\n\n```ruby\nnode.default['openssl']['restart_services'] = ['stats_collector']\n\n# other recipe code here...\nservice 'stats_collector' do\n action [:enable, :start]\nend\n\ninclude_recipe 'openssl::upgrade'\n```\n\nThis will ensure that openssl is upgraded to the latest version so the `stats_collector` service won't be exploited (hopefully!).\n\n```text\nCopyright:: 2009-2011, Opscode, Inc\nCopyright:: 2014, Chef Software, Inc <legal@getchef.com>\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n",
|
||||
"long_description": "openssl Cookbook\n================\n\nThis cookbook provides a library method to generate secure random passwords in recipes using the Ruby OpenSSL library.\n\nIt also provides an attribute-driven recipe for upgrading OpenSSL packages.\n\nRequirements\n------------\n\nThe `secure_password` works on any platform with OpenSSL Ruby bindings installed, which are a requirement for Chef anyway.\n\nThe upgrade recipe works on the following tested platforms:\n\n* Ubuntu 12.04, 14.04\n* Debian 7.4\n* CentOS 6.5\n\nIt may work on other platforms or versions of the above platforms with or without modification.\n\n[Chef Sugar](https://github.com/sethvargo/chef-sugar) was introduced as a dependency to provide helpers that make the default attribute settings (see Attributes) easier to reason about.\n\nAttributes\n----------\n\n* `node['openssl']['packages']` - An array of packages of openssl. The default attributes attempt to be smart about which packages are the default, but this may need to be changed by users of the `openssl::upgrade` recipe.\n* `node['openssl']['restart_services']` - An array of service resources that use the `node['openssl']['packages']`. This is empty by default as Chef has no reliably reasonable way to detect which applications or services are compiled against these packages. *Note* These each need to be \"`service`\" resources specified somewhere in the recipes in the node's run list.\n\nRecipes\n-------\n\n### upgrade\n\nThe upgrade recipe iterates over the list of packages in the `node['openssl']['packages']` attribute and manages them with the `:upgrade` action. Each package will send `:restart` notification to service resources named by the `node['openssl']['restart_services']` attribute.\n\nUsage\n-----\n\nMost often this will be used to generate a secure password for an attribute. In a recipe:\n\n```ruby\n::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)\nnode.default_unless[:my_password] = secure_password\n```\n\nTo use the `openssl::upgrade` recipe, set the attributes as mentioned above. For example, we have a \"stats_collector\" service that uses openssl. It has a recipe that looks like this:\n\nLWRP\n==== \n\nThis cookbook includes an LWRP for generating Self Signed Certificates\n\n## openssl_x509\ngenerate a pem formatted x509 cert + key \n\n### Attributes\n`common_name` A String representing the `CN` ssl field\n`org` A String representing the `O` ssl field\n`org_unit` A String representing the `OU` ssl field\n`country` A String representing the `C` ssl field\n`expire` A Fixnum reprenting the number of days from _now_ to expire the cert\n`key_file` Optional A string to the key file to use. If no key is present it will generate and store one. \n`key_pass` A String that is the key's passphrase\n`key_length` A Fixnum reprenting your desired Bit Length _Default: 2048_\n`owner` The owner of the files _Default: \"root\"_\n`group` The group of the files _Default: \"root\"_\n`mode` The mode to store the files in _Default: \"0400\"_\n\n### Example usage\n\n openssl_x509 \"/tmp/mycert.pem\" do\n common_name \"www.f00bar.com\"\n org \"Foo Bar\"\n org_unit \"Lab\"\n country \"US\"\n end\n\n \nLicense and Author\n==================\n\nAuthor:: Jesse Nelson (<spheromak@gmail.com>)\nAuthor:: Joshua Timberman (<joshua@opscode.com>)\n=======\n\n\n```ruby\nnode.default['openssl']['restart_services'] = ['stats_collector']\n\n# other recipe code here...\nservice 'stats_collector' do\n action [:enable, :start]\nend\n\ninclude_recipe 'openssl::upgrade'\n```\n\nThis will ensure that openssl is upgraded to the latest version so the `stats_collector` service won't be exploited (hopefully!).\n\n```text\nCopyright:: 2009-2011, Opscode, Inc\nCopyright:: 2014, Chef Software, Inc <legal@getchef.com>\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n",
|
||||
"maintainer": "Opscode, Inc.",
|
||||
"maintainer_email": "cookbooks@opscode.com",
|
||||
"license": "Apache 2.0",
|
||||
|
@ -28,4 +28,4 @@
|
|||
"recipes": {
|
||||
"openssl": "Empty, this cookbook provides a library, see README.md"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,8 +65,8 @@ unless node['tomcat']['deploy_manager_apps']
|
|||
end
|
||||
end
|
||||
|
||||
node.set_unless['tomcat']['keystore_password'] = secure_password
|
||||
node.set_unless['tomcat']['truststore_password'] = secure_password
|
||||
node.default_unless['tomcat']['keystore_password'] = secure_password
|
||||
node.default_unless['tomcat']['truststore_password'] = secure_password
|
||||
|
||||
if node['tomcat']['run_base_instance']
|
||||
tomcat_instance "base" do
|
||||
|
|
|
@ -73,7 +73,7 @@ attribute :multilib_policy, :kind_of => String, :equal_to => %w(all best), :defa
|
|||
attribute :obsoletes, :kind_of => [TrueClass, FalseClass], :default => nil
|
||||
attribute :overwrite_groups, :kind_of => [TrueClass, FalseClass], :default => nil
|
||||
attribute :password, :kind_of => String, :regex => /.*/, :default => nil
|
||||
attribute :path, :kind_of => String, :regex => /.*/, :default => nil, :name_attribute => true
|
||||
attribute :path, :kind_of => String, :regex => /.*/, :name_attribute => true
|
||||
attribute :persistdir, :kind_of => String, :regex => /.*/, :default => nil
|
||||
attribute :pluginconfpath, :kind_of => String, :regex => /.*/, :default => nil
|
||||
attribute :pluginpath, :kind_of => String, :regex => /.*/, :default => nil
|
||||
|
|
Loading…
Reference in New Issue