Skip to content

Commit

Permalink
Merge pull request #27 from thmttch/upgrade-to-latest-versions
Browse files Browse the repository at this point in the history
Prepping for 0.7.x, with many changes to support latest versions; see CHANGELOG.md
  • Loading branch information
thmttch authored Dec 9, 2017
2 parents a8471db + 46c8b2a commit e7d94a8
Show file tree
Hide file tree
Showing 14 changed files with 163 additions and 117 deletions.
28 changes: 14 additions & 14 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ driver:
# you can restore this if you want, but it'll be slooooooow
#name: vagrant
name: docker
# https://github.com/test-kitchen/kitchen-docker/issues/207
use_sudo: false
driver_config:
binary: /usr/local/bin/docker
# install latest if not present
Expand All @@ -14,21 +16,12 @@ provisioner:
name: chef_solo

platforms:
# ubuntu: 2 LTS, and the latest
- name: ubuntu-12.04
- name: ubuntu-14.04
- name: ubuntu-15.04
# debian: stable, oldstable
# TODO 7.9 and 8.2 were recently released
- name: debian-7.8
- name: debian-8.1
# centos
- name: centos-5.11
# TODO 6.7 is the latest
- name: centos-6.6
- name: centos-7.1.1503
# redhat: 5.9, 6.6, 7.1
# TODO what's the platform name in docker?
- name: ubuntu-16.04
- name: debian-8.9
- name: debian-9.2
- name: centos-6.9
- name: centos-7.4

suites:
- name: default
Expand All @@ -38,3 +31,10 @@ suites:
anaconda:
flavor: 'x86_64'
accept_license: 'yes'
- name: nbservice
run_list:
- recipe[anaconda::default]
attributes:
anaconda:
flavor: 'x86_64'
accept_license: 'yes'
42 changes: 39 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,46 @@
# CHANGELOG

## 0.6.3 (in development)
## 0.7.0

fixes:
Many, many changes and fixes to support both the latest Chef version and the
latest Anaconda versions.

- fix vagrant-trigger to correctly populate /var/chef/cache on provision
Adds support for Anaconda 4.4.0 and 5.0.1! 5.0.1 is now the default.

### Cookbook changes:

- Adds a `system_path` attribute, for adding Anaconda's bin path to `PATH`.

### Chef changes:

- Dot notation attributes (eg `node.attr1.prop1`) have been deprecated and is
now an error; converted everything to hash/bracket notation (eg
`node['attr1']['prop1']`).
- Cleanups to metadata.rb.

### Updated tested list of OSes

The list of tested OSes has been refined to the latest and penultimate (major)
stable versions. Note that just because an OS is not on the tested list does
not mean it won't work, it just means it is not part of the official test
suite. My experience has been it generally will.

- Ubuntu:
- Removed tests for: 12.04, 15.04
- Added tests for: 16.04
- Debian:
- Removed tests for: 7.8, 8.1
- Added tests for: 8.9, 9.1
- CentOS:
- Removed tests for: 5.11, 6.6, 7.1
- Added tests for: 6.9, 7.4
- Red Hat: completed removed from test suite, in favor of CentOS only

### Development, fixes:

- Gemfile now annotated with rvm metadata for ruby version and gemset.
- Fixed vagrant-trigger to correctly populate /var/chef/cache on provision.
- Fixed bad call to `Chef::Log` with `fatal`.

## 0.6.2

Expand Down
8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# for rvm: https://rvm.io/workflow/projects
#ruby=2.4.2
#ruby-gemset=chef-continuum-anaconda

source 'https://rubygems.org'

gem 'berkshelf'
gem 'chefspec'

gem 'test-kitchen'
# removed in favor of kitchen-docker
#gem 'kitchen-vagrant'
gem 'kitchen-docker'

gem 'foodcritic'

gem 'chef-rewind'

gem 'nokogiri', '~> 1.5.0'
gem 'nokogiri'
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Chef cookbook for installing [Continuum Analytic](http://continuum.io/)'s
distribution for large-scale data processing, predictive analytics, and
scientific computing". Specifically:

- Anaconda 2.2 or 2.3, or 4.4.0
- Anaconda 2.2, 2.3, 4.4.0, 5.0.1 (the default)
- python2 or python3
- x86 or x86_64
- Miniconda
Expand Down Expand Up @@ -67,13 +67,13 @@ installer itself.
# means conda is already in PATH via /etc/profile.d
$> vagrant ssh
$vagrant> conda --version
conda 3.14.1
conda 4.3.30

# or you add it to PATH manually
$> vagrant ssh
$vagrant> export PATH=/opt/anaconda/2.3.0/bin:${PATH}
$vagrant> export PATH=/opt/anaconda/5.0.1/bin:${PATH}
$vagrant> conda --version
conda 3.14.1
conda 4.3.30
```

It includes a Jupyter (IPython) notebook server accessible at <http://33.33.33.123:8888>
Expand Down Expand Up @@ -103,6 +103,8 @@ The following are user-configurable attributes. Check
- `version`: the Anaconda version to install. Valid values are:
- 2.2.0
- 2.3.0
- 4.4.0
- 5.0.1
- latest (for miniconda only)
- `python`: which version of Python to install for. Valid values are:
- python2
Expand Down Expand Up @@ -186,7 +188,13 @@ your own run service template:
end
```

## Tests
## Developer setup and config

install chef-dk; i installed using homebrew: https://github.com/chef/chef-dk

eval "$(chef shell-init bash)" && script/cibuild

### Tests

To run the full test suite:

Expand Down Expand Up @@ -236,8 +244,6 @@ Standard stuff:
## TODO
- add a pre-provision for kitchen tests to avoid redownloading the installer on
every test (really slows down the tests)
- https://github.com/poise/python is now deprecated, in favor of
https://github.com/poise/poise-python; see if the python workaround is still
necessary
Expand Down
Empty file removed attributes/.gitkeep
Empty file.
42 changes: 27 additions & 15 deletions attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# for miniconda this must be 'latest'
default.anaconda.version = '2.3.0'
default['anaconda']['version'] = '5.0.1'
# the version of python: either 'python2' or 'python3'
default.anaconda.python = 'python2'
default['anaconda']['python'] = 'python2'
# the architecture: nil to autodetect, or either 'x86' or 'x86_64'
default.anaconda.flavor = nil
default['anaconda']['flavor'] = nil
# either 'anaconda' or 'miniconda'
default.anaconda.install_type = 'anaconda'
default['anaconda']['install_type'] = 'anaconda'
# add system-wide path to profile.d?
default.anaconda.system_path = false
default['anaconda']['system_path'] = false

default.anaconda.installer_info = {
default['anaconda']['installer_info'] = {
'anaconda' => {
'2.2.0' => {
'python2' => {
Expand Down Expand Up @@ -47,6 +47,18 @@
'x86_64' => '3be5410b2d9db45882c7de07c554cf4f1034becc274ec9074b23fd37a5c87a6f',
},
},
'5.0.1' => {
'python2' => {
'uri_prefix' => 'https://repo.continuum.io/archive',
'x86' => nil,
'x86_64' => nil,
},
'python3' => {
'uri_prefix' => 'https://repo.continuum.io/archive',
'x86' => nil,
'x86_64' => nil,
},
},
},
'miniconda' => {
'latest' => {
Expand All @@ -65,20 +77,20 @@
}

# specific versions are installed _under_ this directory
default.anaconda.install_root = '/opt/anaconda'
default.anaconda.accept_license = 'no'
default.anaconda.package_logfile = nil
default['anaconda']['install_root'] = '/opt/anaconda'
default['anaconda']['accept_license'] = 'no'
default['anaconda']['package_logfile'] = nil

default.anaconda.owner = 'anaconda'
default.anaconda.group = 'anaconda'
default.anaconda.home = "/home/#{node.anaconda.owner}"
default['anaconda']['owner'] = 'anaconda'
default['anaconda']['group'] = 'anaconda'
default['anaconda']['home'] = "/home/#{node['anaconda']['owner']}"

default.anaconda.notebook = {
default['anaconda']['notebook'] = {
# by default, listens on all interfaces; there will be a warning since
# security is disabled
'ip' => '*',
'port' => 8888,
'owner' => node.anaconda.owner,
'group' => node.anaconda.group,
'owner' => node['anaconda']['owner'],
'group' => node['anaconda']['group'],
'install_dir' => '/opt/ipython/server',
}
26 changes: 10 additions & 16 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,21 @@
license 'MIT'
description 'Installs/Configures anaconda'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.0.0'
version '0.7.0'

# TODO enable once release chefdk works for me
#source_url 'https://github.com/thmttch/chef-continuum-anaconda'
#issues_url 'https://github.com/thmttch/chef-continuum-anaconda/issues'
source_url 'https://github.com/thmttch/chef-continuum-anaconda'
issues_url 'https://github.com/thmttch/chef-continuum-anaconda/issues'

supports 'ubuntu', '= 12.04'
supports 'ubuntu', '= 14.04'
supports 'ubuntu', '= 15.04'
chef_version '>= 13'

supports 'debian', '= 7.8'
supports 'debian', '= 8.1'
supports 'ubuntu', '= 14.04'
supports 'ubuntu', '= 16.04'

supports 'centos', '= 5.11'
supports 'centos', '= 6.6'
supports 'centos', '= 7.1.1503'
supports 'debian', '= 8.9'
supports 'debian', '= 9.2'

# TODO
#supports 'redhat', '= 5.9'
#supports 'redhat', '= 6.6'
#supports 'redhat', '= 7.1'
supports 'centos', '= 6.9'
supports 'centos', '= 7.4'

depends 'apt'
depends 'runit'
Expand Down
16 changes: 8 additions & 8 deletions providers/nbservice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ def whyrun_supported?
end

def cmd_ipython
"#{node.anaconda.install_root}/#{node.anaconda.version}/bin/ipython"
"#{node['anaconda']['install_root']}/#{node['anaconda']['version']}/bin/ipython"
end

def is_installed?(package_name)
`"#{cmd_conda}" list`.include?(package_name)
end

def log_opts(node)
if node.anaconda.install_log
"2>&1 >#{node.anaconda.install_log}"
if node['anaconda']['install_log']
"2>&1 >#{node['anaconda']['install_log']}"
else
''
end
Expand All @@ -21,11 +21,11 @@ def log_opts(node)
action :create do
r = new_resource
# fill in any missing attributes with the defaults
ip = r.ip || node.anaconda.notebook.ip
port = r.port || node.anaconda.notebook.port
owner = r.owner || node.anaconda.notebook.owner
group = r.group || node.anaconda.notebook.group
install_dir = r.install_dir || node.anaconda.notebook.install_dir
ip = r.ip || node['anaconda']['notebook']['ip']
port = r.port || node['anaconda']['notebook']['port']
owner = r.owner || node['anaconda']['notebook']['owner']
group = r.group || node['anaconda']['notebook']['group']
install_dir = r.install_dir || node['anaconda']['notebook']['install_dir']

directory install_dir do
owner owner
Expand Down
6 changes: 3 additions & 3 deletions providers/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ def whyrun_supported?
end

def cmd_conda
"#{node.anaconda.install_root}/#{node.anaconda.version}/bin/conda"
"#{node['anaconda']['install_root']}/#{node['anaconda']['version']}/bin/conda"
end

def is_installed?(package_name)
`"#{cmd_conda}" list`.include?(package_name)
end

def log_opts(node)
if node.anaconda.package_logfile
"2>&1 >#{node.anaconda.package_logfile}"
if node['anaconda']['package_logfile']
"2>&1 >#{node['anaconda']['package_logfile']}"
else
''
end
Expand Down
Loading

0 comments on commit e7d94a8

Please sign in to comment.