Skip to content

Commit

Permalink
multiple fixes and improvements; see CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
thmttch committed Aug 17, 2014
1 parent 655a667 commit bdc11ef
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 28 deletions.
9 changes: 7 additions & 2 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ provisioner:

platforms:
- name: ubuntu-12.04
- name: ubuntu-12.10
- name: ubuntu-13.04
# - name: ubuntu-12.10
# driver:
# box: chef/ubuntu-11.10
# - name: ubuntu-13.04
# driver:
# box: chef/ubuntu-13.04
- name: ubuntu-13.10
- name: ubuntu-14.04

suites:
- name: default
Expand Down
34 changes: 33 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
# CHANGELOG

## 0.4.0

Major cleanup and basic usability fixes (read: almost not sure why it worked
before, if it even did):

- (core, breaking) Renamed `anaconda::shell-conveniences` to
`anaconda::shell_conveniences`
- (core, breaking) No longer uses the `python` cookbook; this caused problems
after anaconda was installed
- (core) `shell_conveniences` now installs into `/etc/profile.d`, so it is
automatically sourced by login shells
- (core) Ubuntu 14.04 is now a supported (and fully tested) platform
- (core) Ubuntu 14.04 is now the default platform used in the sample Vagrantfile
- (core) Vagrantfile now correctly installs Anaconda, like the README said it
was supposed to
- (docs) various readme updates
- (testing) Complete coverage of all resources in chefspec
- (testing) Removed Ubuntu 12.10 and 13.04 from kitchen testing; there's
something wrong with `apt-get` on these images. It [appears to
be](http://ubuntuforums.org/showthread.php?t=1542755) [something about the
apt keys](http://ubuntuforums.org/showthread.php?p=7001019#7001019), but
they're just removed from testing for now.

## 0.3.3

Bugfix release:

- Fixes related to install script and permissions
([#5](https://github.com/thmttch/chef-continuum-anaconda/pull/5)). Courtesy
@mwalton236

## 0.3.1

New resource: `anaconda_package`, for installing and removing packages via `conda`
New resource: `anaconda_package`, for installing and removing packages via
`conda`

## 0.3.0

Expand Down
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ comprehensive testing across multiple platforms, with tests written in

## Requirements

This repo has only been tested with RVM; YMMV with other installation methods (rbenv, chef-dk, etc).
This repo has only been tested with RVM; YMMV with other installation methods
(rbenv, chef-dk, etc).

- Berkshelf 3.1.3
- Chefspec 4.0.0
- Test Kitchen 1.2.1
- Foodcritic 4.0.0
- Vagrant 1.6+
- [vagrant-omnibus](https://github.com/schisamo/vagrant-omnibus)
- [vagrant-berkshelf](https://github.com/berkshelf/vagrant-berkshelf): note that `>= 2.0.1` is required
- [vagrant-berkshelf](https://github.com/berkshelf/vagrant-berkshelf): note
that `>= 2.0.1` is required

It sounds like [Chef-DK](http://www.getchef.com/downloads/chef-dk/) is the new
recommended installation path, but I have not had a good experience with it (as
Expand All @@ -45,6 +47,12 @@ $> vagrant ssh
$vagrant> export PATH=/opt/anaconda/2.0.1/bin:${PATH}
$vagrant> conda --version
conda 3.5.5

# if you included `recipe[anaconda::shell_conveniences]` you don't have to do anything;
# it's sourced in /etc/profile.d
$> vagrant ssh
$vagrant> conda --version
conda 3.5.5
```

To use it in a cookbook:
Expand All @@ -71,14 +79,13 @@ The following are user-configurable attributes. Check
- `owner`: the user who owns the install
- `group`: the group who owns the install

### `recipe[anaconda::shell-conveniences]`
### `recipe[anaconda::shell_conveniences]`

Include this to have a `source-me.sh` added to `${HOME}` which you can source
on login. Useful for development.
Include this to have the environment set for all users (login shells) via
`/etc/profile.d`. Useful for development.

```bash
$> vagrant ssh
$vagrant> source source-me.sh
$vagrant> which conda
/opt/anaconda/2.0.1/bin/conda
```
Expand Down Expand Up @@ -107,7 +114,11 @@ tests](test/integration/default/serverspec/default_spec.rb):

```bash
# this is what takes so long: every platform and version is fully built in vagrant
# the list of OSes is defined in [.kitchen.yml](.kitchen.yml)
$> kitchen verify

# test a specific OS; `kitchen list`
$> kitchen verify default-ubuntu-1204
```

Check the style with [Foodcritic](http://acrmp.github.io/foodcritic/):
Expand Down
17 changes: 11 additions & 6 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

Vagrant.configure('2') do |config|
config.vm.hostname = 'anaconda-berkshelf'
config.vm.box = 'precise32'
config.vm.box_url = 'http://files.vagrantup.com/precise32.box'
config.vm.box = 'ubuntu/trusty32'
#config.vm.box = 'precise32'
#config.vm.box_url = 'http://files.vagrantup.com/precise32.box'
config.vm.network :private_network, ip: '33.33.33.123'

# ssh
Expand All @@ -13,6 +14,7 @@ Vagrant.configure('2') do |config|

# plugins
config.berkshelf.enabled = true
#config.berkshelf.berksfile_path = ''
config.omnibus.chef_version = :latest

# provisioning
Expand All @@ -24,6 +26,8 @@ Vagrant.configure('2') do |config|
'Anaconda-1.8.0-Linux-x86_64.sh',
'Anaconda-1.9.2-Linux-x86.sh',
'Anaconda-1.9.2-Linux-x86_64.sh',
'Anaconda-2.0.1-Linux-x86.sh',
'Anaconda-2.0.1-Linux-x86_64.sh',
].each do |f|
if File.exists?(f)
config.vm.provision :shell do |shell|
Expand All @@ -36,16 +40,17 @@ Vagrant.configure('2') do |config|
config.vm.provision :chef_solo do |chef|
chef.json = {
:anaconda => {
#:version => '1.9.2',
#:version => '2.0.1',
#:flavor => 'x86',
:accept_license => 'yes',
}
}

chef.run_list = [
#'recipe[anaconda::default]',
#'recipe[anaconda::shell-conveniences]',
'recipe[anaconda::package_tests]',
'recipe[anaconda::default]',
'recipe[anaconda::shell_conveniences]',
]

chef.custom_config_path = 'vagrant-solo.rb'
end
end
4 changes: 2 additions & 2 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
license 'MIT'
description 'Installs/Configures anaconda'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.3.4'
version '0.4.0'

supports 'ubuntu', '= 12.04'
supports 'ubuntu', '= 13.04'
supports 'ubuntu', '= 13.10'
supports 'ubuntu', '= 14.04'

depends 'apt'
depends 'python'
3 changes: 1 addition & 2 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#

include_recipe 'apt::default'
include_recipe 'python::default'

version = node.anaconda.version
flavor = node.anaconda.flavor
Expand All @@ -34,7 +33,7 @@
template installer_config_path do
source "#{installer_config}.erb"
user node.anaconda.owner
group node.anaconda.group
group node.anaconda.group
variables({
:version => version,
:flavor => flavor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# All rights reserved - Do Not Redistribute
#

template "#{node.anaconda.home}/source-me.sh" do
template '/etc/profile.d/anaconda-env.sh' do
source 'source-me.sh.erb'
variables({
:install_root => node.anaconda.install_root,
Expand Down
28 changes: 20 additions & 8 deletions spec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
end
end

it 'runs without errors. see test-kitchen tests for more comprehensive tests not possible here' do
it 'runs without errors. see test-kitchen tests for more comprehensive tests that are not possible here' do
chef_run.converge(described_recipe)

expect(chef_run).to include_recipe('python::default')
expect(chef_run).to create_directory('/opt/anaconda')
expect(chef_run).to run_bash('run anaconda installer')
end

Expand All @@ -31,12 +31,24 @@

expect(chef_run).to install_conda_package('astroid')
expect(chef_run).to remove_conda_package('astroid')

# for coverage
expect(chef_run).to write_log('do NOT include this in your runlist! for testing only.')
end

it 'provides a convenience shell script' do
chef_run.converge('recipe[anaconda::shell-conveniences]')
chef_run.converge('recipe[anaconda::shell_conveniences]')

expect(chef_run).to create_template('/etc/profile.d/anaconda-env.sh')
end

it 'caches the installer template' do
chef_run.converge(described_recipe)

installer = "Anaconda-#{chef_run.node.anaconda.version}-Linux-#{chef_run.node.anaconda.flavor}.sh"
installer_path = "#{Chef::Config[:file_cache_path]}/#{installer}"

expect(chef_run).to create_template("#{chef_run.node.anaconda.home}/source-me.sh")
expect(chef_run).to create_remote_file_if_missing(installer_path)
end

end
Expand All @@ -45,16 +57,16 @@
describe 'anaconda::default' do
platforms = {
# for whatever reason there's no fauxhai data for 12.10
'ubuntu' => [ '12.04', '13.04', '13.10' ],
'ubuntu' => [ '12.04', '13.04', '13.10', '14.04' ],
'debian' => [ '6.0.5' ],
'centos' => [ '5.8', '6.0', '6.3' ],
'redhat' => [ '5.8', '6.3' ],
}

platforms.each do |platform, versions|
versions.each do |version|
Fauxhai.mock(platform: platform, version: version)
include_examples 'general tests', platform, version
versions.each do |platform_version|
Fauxhai.mock(platform: platform, version: platform_version)
include_examples 'general tests', platform, platform_version
end
end
end
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# https://github.com/sethvargo/chefspec#reporting
require 'chefspec'
require 'chefspec/deprecations'

ChefSpec::Coverage.start! do
end

Expand Down
1 change: 1 addition & 0 deletions vagrant-solo.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Chef::Config.ssl_verify_mode = :verify_peer

0 comments on commit bdc11ef

Please sign in to comment.