Skip to content

Commit

Permalink
Merge branch 'cm/less-magic'
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Maier committed Feb 18, 2014
2 parents b26feef + 651731f commit 90d6e34
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 51 deletions.
22 changes: 22 additions & 0 deletions .kitchen.local.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
platforms:
- name: ubuntu-12.04
attributes:
push_jobs:
package_url: "http://example.com/push-jobs-client-1.0.0-1.deb"
package_checksum: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
- name: ubuntu-10.04
attributes:
push_jobs:
package_url: "http://example.com/push-jobs-client-1.0.0-1.deb"
package_checksum: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
- name: centos-6.4
attributes:
push_jobs:
package_url: "http://example.com/push-jobs-client-1.0.0-1.rpm"
package_checksum: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
- name: centos-5.9
attributes:
push_jobs:
package_url: "http://example.com/push-jobs-client-1.0.0-1.rpm"
package_checksum: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ The default recipe includes the appropriate recipe based on the node's

## linux

If the `node['push_jobs']['package_url']` attribute is set,
this recipe will download the Opscode Push Jobs Client package from
the URL.
The `node['push_jobs']['package_url']` attribute must be set for this
recipe to download the Opscode Push Jobs Client package from the URL.

The recipe will write out the whitelist of
jobs as a separate configuration file.
Expand Down
10 changes: 8 additions & 2 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ Install the berkshelf plugin for vagrant, and berkshelf to your local Ruby envir
vagrant plugin install vagrant-berkshelf
gem install berkshelf

Install Test Kitchen 1.0 (unreleased yet, use the alpha / prerelease version).
Install Test Kitchen 1.0

gem install test-kitchen --pre
gem install test-kitchen

Install the Vagrant driver for Test Kitchen.

gem install kitchen-vagrant

Currently, it is necessary to supply both
`node['push_jobs']['package_url']` and
`node['push_jobs']['package_checksum']` attributes. See the
`.kitchen.local.yml.example` file for how you can do this. Simply
copy that file to `.kitchen.local.yml` and edit it as appropriate.

Once the above are installed, you should be able to run Test Kitchen:

kitchen list
Expand Down
32 changes: 0 additions & 32 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

default['push_jobs']['package_url'] = nil
default['push_jobs']['package_checksum'] = ''
default['push_jobs']['package_version'] = '1.0.0-1'
default['push_jobs']['gem_url'] = nil
default['push_jobs']['gem_checksum'] = ''

Expand All @@ -31,34 +30,3 @@
when 'windows'
default['push_jobs']['service_string'] = 'service[pushy-client]'
end

# These are the sha256 checksums of each platform's package, for when they are determined and retrieved algorithmically
default['push_jobs']['default_package_checksums'] = {
'opscode-push-jobs-client-1.0.0%2B20131028192012-1.windows.msi' => 'ab3deb425682b1f025fce1980b91ed88d0912051c0801c7a295a17c2ac75096a',
'opscode-push-jobs-client-1.0.0-1.el5.i686.rpm' => '0e6023b7d1b853eed63133f7d1e63fd6d55f5a06793098f016063669162bfae8',
'opscode-push-jobs-client-1.0.0-1.el5.x86_64.rpm' => 'fadfa187e67f79f5d079843c7758a369dd9237be2db83fad46b24d607f827056',
'opscode-push-jobs-client-1.0.0-1.el6.i686.rpm' => 'acda0d7389b81ead4e83883177a6c28fdafdd1f889229cc5c4c90646213a8c88',
'opscode-push-jobs-client-1.0.0-1.el6.x86_64.rpm' => 'aaf73394de3bcea955fd791aa50d0ee27aaea8a0ac54fb839d31313912814343',
'opscode-push-jobs-client_1.0.0-1.ubuntu.10.04_amd64.deb' => '1dbfaf2f2e7c427c3dc53cc66df03c38dc4a91f4dc07145ec300da35de0cbf86',
'opscode-push-jobs-client_1.0.0-1.ubuntu.10.04_i386.deb' => '6a72eb218c66bf4155ed71ce358724d905c351c8e8894a2eb6806387ac7a9066',
'opscode-push-jobs-client_1.0.0-1.ubuntu.11.04_amd64.deb' => '8aa01ffbeba089cc321fc0a0aab2e8064f69120165e638e79d3b1cd713904f1a',
'opscode-push-jobs-client_1.0.0-1.ubuntu.11.04_i386.deb' => 'db91e682c782e32042d43d9ec39eec0d47f9348ea998177d3b2ae29402640035',
'opscode-push-jobs-client_1.0.0-1.ubuntu.12.04_amd64.deb' => 'b32e439f1fd6f38dc7acfeb2d31fb173e9d5b3cbb439f88cee0ed19b2229e97b'
}

package_version = node['push_jobs']['package_version']
package_machine = node['kernel']['machine']
url_host = "https://opscode-push-jobs-client.s3.amazonaws.com/#{package_version}"

case node['platform_family']
when 'debian'
package_machine = 'amd64' if package_machine == 'x86_64'
case node['platform']
when 'ubuntu'
default['push_jobs']['package_url'] = "#{url_host}/opscode-push-jobs-client_#{package_version}.ubuntu.#{node['platform_version']}_#{package_machine}.deb"
end
when 'rhel'
default['push_jobs']['package_url'] = "#{url_host}/opscode-push-jobs-client-#{package_version}.el#{node['platform_version'].to_i}.#{node['kernel']['machine']}.rpm"
when 'windows'
default['push_jobs']['package_url'] = "#{url_host}/opscode-push-jobs-client-1.0.0%2B20131028192012-1.windows.msi"
end
1 change: 0 additions & 1 deletion libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ def self.package_file(url = 'http://www.opscode.com/chef/install.sh')
package_file = File.basename(uri.path)
package_file
end

end
4 changes: 4 additions & 0 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
# limitations under the License.
#

unless (node['push_jobs']['package_url'] && node['push_jobs']['package_checksum'])
raise "Please specify ['push_jobs']['package_url'] and ['push_jobs']['package_checksum'] attributes."
end

case node['platform_family']
when 'windows'
include_recipe 'push-jobs::windows'
Expand Down
10 changes: 3 additions & 7 deletions recipes/linux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@
# Do not continue if trying to run the Linux recipe on Windows
raise 'This recipe does not support Windows' if node['platform_family'] == 'windows'

if node['push_jobs']['package_url'] && node['push_jobs']['package_checksum']
package_url = node['push_jobs']['package_url']
package_file = PushJobsHelper.package_file(node['push_jobs']['package_url'])
package_checksum = node['push_jobs']['package_checksum']
else
raise "Unable to determine proper Push Jobs Client package for platform #{node['platform']} version #{node['platform_version']} on #{node['kernel']['machine']}. Please specify package_url and package_checksum explicitly."
end
package_url = node['push_jobs']['package_url']
package_file = PushJobsHelper.package_file(node['push_jobs']['package_url'])
package_checksum = node['push_jobs']['package_checksum']

remote_file "#{Chef::Config[:file_cache_path]}/#{package_file}" do
source package_url
Expand Down
7 changes: 1 addition & 6 deletions recipes/windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@
# Do not continue if trying to run the Windows recipe on non-Windows
raise 'This recipe only supports Windows' unless node['platform_family'] == 'windows'

# OC-7332: need the version as part of the DisplayName. Hardcoding is
# fine for now, it will be removed from the installer when the ticket
# is resolved.
display_name = 'Opscode Push Jobs Client Installer for Windows v0.0.1'

windows_package display_name do
windows_package "Opscode Push Jobs Client Installer for Windows" do
source node['push_jobs']['package_url']
checksum node['push_jobs']['package_checksum']
end
Expand Down

0 comments on commit 90d6e34

Please sign in to comment.