├── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .kitchen.cloud.yml ├── .kitchen.yml ├── .rubocop.yml ├── .travis.yml ├── Berksfile ├── CHANGELOG.md ├── CONTRIBUTING.md ├── Gemfile ├── Guardfile ├── README.md ├── Rakefile ├── TESTING.md ├── chefignore ├── metadata.rb ├── spec ├── spec_helper.rb └── unit │ └── recipes │ └── default_spec.rb ├── tasks └── maintainers.rb └── test ├── fixtures └── cookbooks │ └── test │ ├── README.md │ ├── attributes │ └── default.rb │ ├── metadata.rb │ └── recipes │ ├── default.rb │ ├── local.rb │ └── repo.rb └── integration ├── data_bags ├── .gitkeep └── vault │ └── .gitkeep ├── default └── serverspec │ └── default_spec.rb ├── helpers └── serverspec │ └── spec_helper.rb ├── local_package_install └── serverspec │ └── assert_local_package_installed_spec.rb ├── nodes ├── .gitkeep └── sample-node.json └── override_package_versions └── serverspec └── assert_package_version_installed_spec.rb /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Cookbook version 2 | [Version of the cookbook where you are encountering the issue] 3 | 4 | ### Chef-client version 5 | [Version of chef-client in your environment] 6 | 7 | ### Platform Details 8 | [Operating system distribution and release version. Cloud provider if running in the cloud] 9 | 10 | ### Scenario: 11 | [What you are trying to achieve and you can't?] 12 | 13 | ### Steps to Reproduce: 14 | [If you are filing an issue what are the things we need to do in order to repro your problem? How are you using this cookbook or any resources it includes?] 15 | 16 | ### Expected Result: 17 | [What are you expecting to happen as the consequence of above reproduction steps?] 18 | 19 | ### Actual Result: 20 | [What actually happens after the reproduction steps? Include the error output or a link to a gist if possible.] 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Description 2 | 3 | [Describe what this change achieves] 4 | 5 | ### Issues Resolved 6 | 7 | [List any existing issues this PR resolves] 8 | 9 | ### Check List 10 | - [ ] All tests pass. See https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD 11 | - [ ] New functionality includes testing. 12 | - [ ] New functionality has been documented in the README if applicable 13 | - [ ] The CLA has been signed. See https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD 14 | 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | .zero-knife.rb 3 | *.rbc 4 | .bundle 5 | .config 6 | coverage 7 | InstalledFiles 8 | lib/bundler/man 9 | pkg 10 | rdoc 11 | spec/reports 12 | test/tmp 13 | test/version_tmp 14 | tmp 15 | Gemfile.lock 16 | _Store 17 | *~ 18 | *# 19 | .#* 20 | \#*# 21 | .*.sw[a-z] 22 | *.un~ 23 | *.tmp 24 | *.bk 25 | *.bkup 26 | .ruby-version 27 | .ruby-gemset 28 | .rvmrc 29 | 30 | # YARD artifacts 31 | .yardoc 32 | _yardoc 33 | doc/ 34 | .idea 35 | 36 | #chef stuff 37 | Berksfile.lock 38 | .kitchen 39 | .kitchen.local.yml 40 | vendor/ 41 | .coverage/ 42 | 43 | #vagrant stuff 44 | .vagrant/ 45 | .vagrant.d/ 46 | .kitchen/ 47 | -------------------------------------------------------------------------------- /.kitchen.cloud.yml: -------------------------------------------------------------------------------- 1 | #<% require 'kitchen-sync' %> 2 | --- 3 | driver_config: 4 | digitalocean_api_token: <%= ENV['DIGITALOCEAN_API_TOKEN'] %> 5 | 6 | provisioner: 7 | name: chef_zero 8 | require_chef_omnibus: latest 9 | 10 | platforms: 11 | - name: ubuntu-12.04 12 | driver_plugin: digital_ocean 13 | driver_config: 14 | size: 2gb 15 | image: ubuntu-12-04-x64 16 | region: <%= ENV['DIGITALOCEAN_REGION'] %> 17 | ssh_key_ids: <%= ENV['DIGITALOCEAN_SSH_KEYS'] %> 18 | ssh_key: <%= ENV['DIGITALOCEAN_SSH_KEY_PATH'] %> 19 | run_list: 20 | - recipe[apt] 21 | 22 | - name: ubuntu-14.04 23 | driver_plugin: digital_ocean 24 | driver_config: 25 | size: 2gb 26 | image: ubuntu-14-04-x64 27 | region: <%= ENV['DIGITALOCEAN_REGION'] %> 28 | ssh_key_ids: <%= ENV['DIGITALOCEAN_SSH_KEYS'] %> 29 | ssh_key: <%= ENV['DIGITALOCEAN_SSH_KEY_PATH'] %> 30 | run_list: 31 | - recipe[apt] 32 | 33 | - name: centos-5.8 34 | driver_plugin: digital_ocean 35 | driver_config: 36 | size: 2gb 37 | image: centos-5-8-x64 38 | region: <%= ENV['DIGITALOCEAN_REGION'] %> 39 | ssh_key_ids: <%= ENV['DIGITALOCEAN_SSH_KEYS'] %> 40 | ssh_key: <%= ENV['DIGITALOCEAN_SSH_KEY_PATH'] %> 41 | 42 | - name: centos-6.5 43 | driver_plugin: digital_ocean 44 | driver_config: 45 | size: 2gb 46 | image: centos-6-5-x64 47 | region: <%= ENV['DIGITALOCEAN_REGION'] %> 48 | ssh_key_ids: <%= ENV['DIGITALOCEAN_SSH_KEYS'] %> 49 | ssh_key: <%= ENV['DIGITALOCEAN_SSH_KEY_PATH'] %> 50 | 51 | suites: 52 | - name: default 53 | run_list: 54 | - recipe[test] 55 | - recipe[test::repo] 56 | attributes: 57 | 58 | - name: override_package_versions 59 | run_list: 60 | - recipe[test] 61 | - recipe[test::repo] 62 | attributes: 63 | test: 64 | chef-server-core: 65 | version: 12.0.4-1 66 | 67 | - name: local_package_install 68 | run_list: 69 | - recipe[test] 70 | - recipe[test::local] 71 | attributes: 72 | -------------------------------------------------------------------------------- /.kitchen.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: 3 | name: vagrant 4 | customize: 5 | memory: 2048 6 | cpus: 2 7 | 8 | provisioner: 9 | name: chef_zero 10 | 11 | platforms: 12 | - name: centos-5.11 13 | - name: centos-6.7 14 | - name: centos-7.2 15 | - name: ubuntu-10.04 16 | run_list: apt::default 17 | - name: ubuntu-12.04 18 | run_list: apt::default 19 | - name: ubuntu-14.04 20 | run_list: apt::default 21 | 22 | suites: 23 | - name: default 24 | run_list: 25 | - recipe[test] 26 | - recipe[test::repo] 27 | attributes: 28 | 29 | - name: override_package_versions 30 | run_list: 31 | - recipe[test] 32 | - recipe[test::repo] 33 | attributes: 34 | test: 35 | chef-server-core: 36 | version: 12.0.4-1 37 | 38 | - name: local_package_install 39 | run_list: 40 | - recipe[test] 41 | - recipe[test::local] 42 | attributes: 43 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | Exclude: 3 | - vendor/**/* 4 | - Guardfile 5 | - test/**/* 6 | 7 | AlignParameters: 8 | Enabled: false 9 | ClassLength: 10 | Enabled: false 11 | CyclomaticComplexity: 12 | Enabled: false 13 | Documentation: 14 | Enabled: false 15 | Encoding: 16 | Enabled: false 17 | Style/FileName: 18 | Enabled: false 19 | LineLength: 20 | Enabled: false 21 | MethodLength: 22 | Enabled: false 23 | Metrics/AbcSize: 24 | Enabled: false 25 | PerceivedComplexity: 26 | Enabled: false 27 | Style/SpaceBeforeFirstArg: 28 | Enabled: false 29 | Style/ClassAndModuleChildren: 30 | Enabled: false 31 | Style/FileName: 32 | Enabled: false 33 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Use Travis's cointainer based infrastructure 2 | sudo: false 3 | addons: 4 | apt: 5 | sources: 6 | - chef-current-precise 7 | packages: 8 | - chefdk 9 | 10 | # Don't `bundle install` 11 | install: echo "skip bundle install" 12 | 13 | branches: 14 | only: 15 | - master 16 | 17 | # Ensure we make ChefDK's Ruby the default 18 | before_script: 19 | - eval "$(/opt/chefdk/bin/chef shell-init bash)" 20 | # We have to install chef-sugar for ChefSpec 21 | - /opt/chefdk/embedded/bin/chef gem install chef-sugar 22 | script: 23 | - /opt/chefdk/embedded/bin/chef --version 24 | - /opt/chefdk/embedded/bin/rubocop --version 25 | - /opt/chefdk/embedded/bin/rubocop 26 | - /opt/chefdk/embedded/bin/foodcritic --version 27 | - /opt/chefdk/embedded/bin/foodcritic . --exclude spec 28 | - /opt/chefdk/embedded/bin/rspec spec 29 | -------------------------------------------------------------------------------- /Berksfile: -------------------------------------------------------------------------------- 1 | source 'https://supermarket.chef.io' 2 | 3 | metadata 4 | 5 | group :integration do 6 | cookbook 'apt' 7 | cookbook 'test', path: './test/fixtures/cookbooks/test' 8 | end 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | chef-server-ingredients CHANGELOG 2 | ================================= 3 | 4 | v0.5.2 (2015-09-11) 5 | ------------------- 6 | 7 | - Another dependency update for `chef-ingredient`, because: 8 | 9 | https://github.com/chef-cookbooks/chef-ingredient/commit/949f6f54079a28121c9505e9bffbf36b218f7ecb#diff-e360fa10c8346d468ba143afceecbc62L25 10 | 11 | v0.5.1 (2015-09-11) 12 | ------------------- 13 | 14 | - Update the dependency on `chef-ingredient` that has backwards-compatibility properties. But really. Stop using this cookbook. :-) 15 | 16 | v0.5.0 (2015-06-22) 17 | ------------------- 18 | 19 | - Final release, this cookbook is **deprecated**. Use chef-ingredient. 20 | 21 | v0.4.0 (2015-06-11) 22 | ------------------- 23 | 24 | - Add timeout attribute to `chef_server_ingredient` 25 | - Use `declare_resource` DSL method to select local package resource 26 | - Allow specifying the repository name for the packagecloud repo 27 | 28 | v0.3.2 (2015-04-15) 29 | -------------------- 30 | - adding proxy support for packagecloud 31 | 32 | v0.3.1 (2015-04-09) 33 | -------------------- 34 | - Various refactoring and cleanup 35 | 36 | v0.3.0 37 | ------ 38 | - Add ctl command for supermarket 39 | 40 | v0.2.0 41 | ------ 42 | - Add reconfigure property to ingredient resource 43 | 44 | v0.1.0 45 | ------ 46 | - Release this cookbook to Supermarket 47 | 48 | v0.0.2 49 | ------ 50 | - #4: define the installed attribute 51 | - #1, #2, use packagecloud cookbook 52 | 53 | v0.0.1 54 | -------- 55 | - Initial release 56 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Please refer to 2 | https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | group :rake do 4 | gem 'rake' 5 | gem 'tomlrb' 6 | end 7 | 8 | group :lint do 9 | gem 'foodcritic', '~> 5.0' 10 | gem 'rubocop', '~> 0.34' 11 | end 12 | 13 | group :unit do 14 | gem 'berkshelf', '~> 4.0' 15 | gem 'chefspec', '~> 4.4' 16 | end 17 | 18 | group :kitchen_common do 19 | gem 'test-kitchen', '~> 1.4' 20 | end 21 | 22 | group :development do 23 | gem 'ruby_gntp' 24 | gem 'growl' 25 | gem 'rb-fsevent' 26 | gem 'guard', '~> 2.4' 27 | gem 'guard-kitchen' 28 | gem 'guard-foodcritic' 29 | gem 'guard-rspec' 30 | gem 'guard-rubocop' 31 | end 32 | -------------------------------------------------------------------------------- /Guardfile: -------------------------------------------------------------------------------- 1 | # More info at https://github.com/guard/guard#readme 2 | 3 | # guard 'foodcritic', :cookbook_paths => '.', :cli => '-t ~FC023 -t ~FC005', :all_on_start => false do 4 | # watch(/attributes\/.+\.rb$/) 5 | # watch(/providers\/.+\.rb$/) 6 | # watch(/recipes\/.+\.rb$/) 7 | # watch(/resources\/.+\.rb$/) 8 | # watch('metadata.rb') 9 | # end 10 | 11 | guard 'rubocop' do 12 | watch(/attributes\/.+\.rb$/) 13 | watch(/providers\/.+\.rb$/) 14 | watch(/recipes\/.+\.rb$/) 15 | watch(/resources\/.+\.rb$/) 16 | watch('metadata.rb') 17 | end 18 | 19 | guard :rspec, cmd: 'chef exec /opt/chefdk/embedded/bin/rspec', all_on_start: false, notification: false do 20 | watch(/^libraries\/(.+)\.rb$/) 21 | watch(/^spec\/(.+)_spec\.rb$/) 22 | watch(/^(recipes)\/(.+)\.rb$/) { |m| "spec/#{m[1]}_spec.rb" } 23 | watch('spec/spec_helper.rb') { 'spec' } 24 | end 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deprecated 2 | 3 | This cookbook is deprecated. Use [chef-ingredient](https://supermarket.chef.io/cookbooks/chef-ingredient). 4 | 5 | The chef-ingredient cookbook has the `chef_server_ingredient` resource as a compatibility shim only, and consumers of that resource need to switch to the `chef_ingredient` resource immediately. For now this cookbook depends specifically on version 0.5.0 of chef-ingredient. A refactor to use product names instead of package names will break the ability to use `chef_server_ingredient` in this way. 6 | 7 | License and Author 8 | ------------------ 9 | - Author: Joshua Timberman 10 | - Copyright (C) 2014-2015, Chef Software Inc. 11 | 12 | Licensed under the Apache License, Version 2.0 (the "License"); 13 | you may not use this file except in compliance with the License. 14 | You may obtain a copy of the License at 15 | 16 | http://www.apache.org/licenses/LICENSE-2.0 17 | 18 | Unless required by applicable law or agreed to in writing, software 19 | distributed under the License is distributed on an "AS IS" BASIS, 20 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | See the License for the specific language governing permissions and 22 | limitations under the License. 23 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'rspec/core/rake_task' 2 | require 'rubocop/rake_task' 3 | require 'foodcritic' 4 | require 'kitchen' 5 | 6 | require_relative 'tasks/maintainers' 7 | 8 | # Style tests. Rubocop and Foodcritic 9 | namespace :style do 10 | desc 'Run Ruby style checks' 11 | RuboCop::RakeTask.new(:ruby) 12 | 13 | desc 'Run Chef style checks' 14 | FoodCritic::Rake::LintTask.new(:chef) do |t| 15 | t.options = { 16 | fail_tags: ['any'], 17 | tags: ['~FC005'] 18 | } 19 | end 20 | end 21 | 22 | desc 'Run all style checks' 23 | task style: ['style:chef', 'style:ruby'] 24 | 25 | # Rspec and ChefSpec 26 | desc 'Run ChefSpec examples' 27 | RSpec::Core::RakeTask.new(:spec) 28 | 29 | # Integration tests. Kitchen.ci 30 | namespace :integration do 31 | desc 'Run Test Kitchen with Vagrant' 32 | task :vagrant do 33 | Kitchen.logger = Kitchen.default_file_logger 34 | Kitchen::Config.new.instances.each do |instance| 35 | instance.test(:always) 36 | end 37 | end 38 | 39 | desc 'Run Test Kitchen with cloud plugins' 40 | task :cloud do 41 | run_kitchen = true 42 | if ENV['TRAVIS'] == 'true' && ENV['TRAVIS_PULL_REQUEST'] != 'false' 43 | run_kitchen = false 44 | end 45 | 46 | if run_kitchen 47 | Kitchen.logger = Kitchen.default_file_logger 48 | @loader = Kitchen::Loader::YAML.new(project_config: './.kitchen.cloud.yml') 49 | config = Kitchen::Config.new(loader: @loader) 50 | config.instances.each do |instance| 51 | instance.test(:always) 52 | end 53 | end 54 | end 55 | end 56 | 57 | desc 'Run all tests on Travis' 58 | task travis: ['style', 'spec', 'integration:cloud'] 59 | 60 | # Default 61 | task default: ['style', 'spec', 'integration:vagrant'] 62 | -------------------------------------------------------------------------------- /TESTING.md: -------------------------------------------------------------------------------- 1 | Please refer to 2 | https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD 3 | -------------------------------------------------------------------------------- /chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # or sharing to the community site. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | Icon? 9 | nohup.out 10 | ehthumbs.db 11 | Thumbs.db 12 | 13 | # SASS # 14 | ######## 15 | .sass-cache 16 | 17 | # EDITORS # 18 | ########### 19 | \#* 20 | .#* 21 | *~ 22 | *.sw[a-z] 23 | *.bak 24 | REVISION 25 | TAGS* 26 | tmtags 27 | *_flymake.* 28 | *_flymake 29 | *.tmproj 30 | .project 31 | .settings 32 | mkmf.log 33 | 34 | ## COMPILED ## 35 | ############## 36 | a.out 37 | *.o 38 | *.pyc 39 | *.so 40 | *.com 41 | *.class 42 | *.dll 43 | *.exe 44 | */rdoc/ 45 | 46 | # Testing # 47 | ########### 48 | .watchr 49 | .rspec 50 | spec/* 51 | spec/fixtures/* 52 | test/* 53 | features/* 54 | examples/* 55 | Guardfile 56 | Procfile 57 | test/* 58 | spec/* 59 | 60 | # SCM # 61 | ####### 62 | .git 63 | */.git 64 | .gitignore 65 | .gitmodules 66 | .gitconfig 67 | .gitattributes 68 | .svn 69 | */.bzr/* 70 | */.hg/* 71 | */.svn/* 72 | 73 | # Berkshelf # 74 | ############# 75 | Berksfile 76 | Berksfile.lock 77 | cookbooks/* 78 | tmp 79 | 80 | # Cookbooks # 81 | ############# 82 | CONTRIBUTING 83 | CHANGELOG* 84 | 85 | # Strainer # 86 | ############ 87 | Colanderfile 88 | Strainerfile 89 | .colander 90 | .strainer 91 | 92 | # Vagrant # 93 | ########### 94 | .vagrant 95 | Vagrantfile 96 | 97 | # Travis # 98 | ########## 99 | .travis.yml 100 | -------------------------------------------------------------------------------- /metadata.rb: -------------------------------------------------------------------------------- 1 | name 'chef-server-ingredient' 2 | 3 | maintainer 'Chef Software, Inc.' 4 | maintainer_email 'cookbooks@chef.io' 5 | license 'Apache 2.0' 6 | description 'Manages Chef Server packages/add-ons, aka "ingredients"' 7 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) 8 | version '0.5.2' 9 | 10 | depends 'chef-ingredient', '= 0.11.3' 11 | 12 | source_url 'https://github.com/chef-cookbooks/chef-server-ingredient' if respond_to?(:source_url) 13 | issues_url 'https://github.com/chef-cookbooks/chef-server-ingredient/issues' if respond_to?(:source_url) 14 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | at_exit { ChefSpec::Coverage.report! } 5 | -------------------------------------------------------------------------------- /spec/unit/recipes/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'default recipe on Ubuntu 14.04' do 4 | let(:chef_run) do 5 | ChefSpec::ServerRunner.new do |node| 6 | node.automatic[:lsb][:codename] = 'trusty' 7 | end.converge('chef-server-ingredient::default') 8 | end 9 | 10 | it 'converges successfully' do 11 | expect { :chef_run }.to_not raise_error 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /tasks/maintainers.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright:: Copyright (c) 2015 Chef Software, Inc. 3 | # License:: Apache License, Version 2.0 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | require 'rake' 19 | 20 | SOURCE = File.join(File.dirname(__FILE__), '..', 'MAINTAINERS.toml') 21 | TARGET = File.join(File.dirname(__FILE__), '..', 'MAINTAINERS.md') 22 | 23 | begin 24 | require 'tomlrb' 25 | task default: 'maintainers:generate' 26 | 27 | namespace :maintainers do 28 | desc 'Generate MarkDown version of MAINTAINERS file' 29 | task :generate do 30 | @toml = Tomlrb.load_file SOURCE 31 | out = "\n\n" 32 | 33 | out << preamble 34 | out << project_lieutenant 35 | out << all_maintainers 36 | 37 | File.open(TARGET, 'w') do |fn| 38 | fn.write out 39 | end 40 | end 41 | end 42 | 43 | rescue LoadError 44 | STDERR.puts "\n*** TomlRb not available.\n\n" 45 | end 46 | 47 | private 48 | 49 | def preamble 50 | <<-EOL 51 | # #{@toml['Preamble']['title']} 52 | #{@toml['Preamble']['text']} 53 | EOL 54 | end 55 | 56 | def project_lieutenant 57 | <<-EOL 58 | # #{@toml['Org']['Components']['Core']['title']} 59 | #{github_link(@toml['Org']['Components']['Core']['lieutenant'])} 60 | 61 | EOL 62 | end 63 | 64 | def all_maintainers 65 | text = "# Maintainers\n" 66 | @toml['Org']['Components']['Core']['maintainers'].each do |m| 67 | text << "#{github_link(m)}\n" 68 | end 69 | text 70 | end 71 | 72 | def github_link(person) 73 | name = @toml['people'][person]['name'] 74 | github = @toml['people'][person]['github'] 75 | "* [#{name}](https://github.com/#{github})" 76 | end 77 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/README.md: -------------------------------------------------------------------------------- 1 | This is a test cookbook 2 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/attributes/default.rb: -------------------------------------------------------------------------------- 1 | default['test']['chef-server-core']['version'] = nil 2 | default['test']['source_url'] = case node['platform_family'] 3 | when 'debian' 4 | if node['platform_version'].to_f == 14.04 5 | 'https://web-dl.packagecloud.io/chef/stable/packages/ubuntu/trusty/chef-server-core_12.0.5-1_amd64.deb' 6 | elsif node['platform_version'].to_f == 12.04 7 | 'https://web-dl.packagecloud.io/chef/stable/packages/ubuntu/precise/chef-server-core_12.0.5-1_amd64.deb' 8 | elsif node['platform_version'].to_f == 10.04 9 | 'https://web-dl.packagecloud.io/chef/stable/packages/ubuntu/lucid/chef-server-core_12.0.5-1_amd64.deb' 10 | end 11 | when 'rhel' 12 | if node['platform_version'].to_i == 6 13 | 'https://web-dl.packagecloud.io/chef/stable/packages/el/6/chef-server-core-12.0.5-1.el6.x86_64.rpm' 14 | elsif node['platform_version'].to_i == 5 15 | 'https://web-dl.packagecloud.io/chef/stable/packages/el/5/chef-server-core-12.0.5-1.el5.x86_64.rpm' 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'test' 2 | version '0.0.1' 3 | 4 | depends 'chef-server-ingredient' 5 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/default.rb: -------------------------------------------------------------------------------- 1 | remote_file '/etc/pki/tls/certs/ca-bundle.crt' do 2 | source 'http://opscode-omnibus-cache.s3.amazonaws.com/cacerts-2014.07.15-fd48275847fa10a8007008379ee902f1' 3 | checksum 'a9cce49cec92304d29d05794c9b576899d8a285659b3f987dd7ed784ab3e0621' 4 | sensitive true 5 | end if platform_family?('rhel') 6 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/local.rb: -------------------------------------------------------------------------------- 1 | # helper methods for recipe clariy 2 | 3 | pkgname = ::File.basename(node['test']['source_url']) 4 | cache_path = Chef::Config[:file_cache_path] 5 | 6 | # recipe 7 | remote_file "#{cache_path}/#{pkgname}" do 8 | source node['test']['source_url'] 9 | mode '0644' 10 | end 11 | 12 | chef_server_ingredient 'chef-server-core' do 13 | package_source "#{cache_path}/#{pkgname}" 14 | action [:install] 15 | end 16 | 17 | file '/tmp/chef-server-core.firstrun' do 18 | content 'ilovechef\n' 19 | notifies :reconfigure, 'chef_server_ingredient[chef-server-core]' 20 | action :create 21 | end 22 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/repo.rb: -------------------------------------------------------------------------------- 1 | # Chef Server Core 2 | chef_server_ingredient 'chef-server-core' do 3 | version node['test']['chef-server-core']['version'] 4 | action :install 5 | end 6 | 7 | file '/tmp/chef-server-core.firstrun' do 8 | content 'ilovechef\n' 9 | notifies :reconfigure, 'chef_server_ingredient[chef-server-core]' 10 | action :create 11 | end 12 | 13 | # Management Console 14 | chef_server_ingredient 'opscode-manage' do 15 | action :install 16 | end 17 | 18 | file '/tmp/opscode-manage.firstrun' do 19 | content 'ilovechef\n' 20 | notifies :reconfigure, 'chef_server_ingredient[opscode-manage]' 21 | action :create 22 | end 23 | -------------------------------------------------------------------------------- /test/integration/data_bags/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chef-boneyard/chef-server-ingredient/5df529b4cd4b384a5f3801d04739c231cd47196f/test/integration/data_bags/.gitkeep -------------------------------------------------------------------------------- /test/integration/data_bags/vault/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chef-boneyard/chef-server-ingredient/5df529b4cd4b384a5f3801d04739c231cd47196f/test/integration/data_bags/vault/.gitkeep -------------------------------------------------------------------------------- /test/integration/default/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'chef-server-ingredient::default' do 4 | describe package('chef-server-core') do 5 | it { should be_installed } 6 | end 7 | 8 | describe command('chef-server-ctl test') do 9 | its(:exit_status) { should eq 0 } 10 | end 11 | 12 | describe package('opscode-manage') do 13 | it { should be_installed } 14 | end 15 | 16 | describe command('opscode-manage-ctl test') do 17 | its(:exit_status) { should eq 0 } 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /test/integration/helpers/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /test/integration/local_package_install/serverspec/assert_local_package_installed_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'chef-server-ingredient::default' do 4 | describe package('chef-server-core') do 5 | it { should be_installed } 6 | end 7 | 8 | describe command('chef-server-ctl test') do 9 | its(:exit_status) { should eq 0 } 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /test/integration/nodes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chef-boneyard/chef-server-ingredient/5df529b4cd4b384a5f3801d04739c231cd47196f/test/integration/nodes/.gitkeep -------------------------------------------------------------------------------- /test/integration/nodes/sample-node.json: -------------------------------------------------------------------------------- 1 | { 2 | "chef_type": "node", 3 | "name": "sample-node", 4 | "chef_environment": "_default", 5 | "recipe": [ 6 | 7 | ], 8 | "run_list": [ 9 | 10 | ], 11 | "normal": { 12 | 13 | }, 14 | "automatic": { 15 | "kernel": { 16 | "name": "Linux", 17 | "machine": "x86_64", 18 | "os": "GNU/Linux" 19 | }, 20 | "os": "linux", 21 | "os_version": "3.5.0-23-generic", 22 | "root_group": "root", 23 | "etc": { 24 | "passwd": { 25 | "root": { 26 | "dir": "/root", 27 | "gid": 0, 28 | "uid": 0, 29 | "shell": "/bin/bash", 30 | "gecos": "root" 31 | } 32 | }, 33 | "group": { 34 | "root": { 35 | "gid": 0, 36 | "members": [ 37 | 38 | ] 39 | } 40 | } 41 | }, 42 | "current_user": "vagrant", 43 | "hostname": "sample-server-ubuntu-1204", 44 | "fqdn": "sample-server-ubuntu-1204.example.com", 45 | "domain": "example.com", 46 | "ipaddress": "10.0.2.47", 47 | "macaddress": "08:00:27:F9:09:1F", 48 | "ip6address": "fe80::a00:27ff:fef9:91f", 49 | "virtualization": { 50 | "system": "vbox", 51 | "role": "guest" 52 | }, 53 | "ohai_time": 1389202858.7629967, 54 | "lsb": { 55 | "id": "Ubuntu", 56 | "release": "12.04", 57 | "codename": "precise", 58 | "description": "Ubuntu 12.04.2 LTS" 59 | }, 60 | "platform": "ubuntu", 61 | "platform_version": "12.04", 62 | "platform_family": "debian", 63 | "cpu": { 64 | "total": 1, 65 | "real": 0 66 | }, 67 | "memory": { 68 | "total": "244960kB", 69 | "free": "16628kB" 70 | }, 71 | "uptime_seconds": 390, 72 | "uptime": "6 minutes 30 seconds", 73 | "idletime_seconds": 343, 74 | "idletime": "5 minutes 43 seconds", 75 | "recipes": [ 76 | ], 77 | "roles": [ 78 | ] 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /test/integration/override_package_versions/serverspec/assert_package_version_installed_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'chef-server-ingredient::default' do 4 | describe package('chef-server-core') do 5 | it { should be_installed.with_version('12.0.4-1') } 6 | end 7 | end 8 | --------------------------------------------------------------------------------