Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fedora support #52

Merged
merged 2 commits into from
Jun 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .kitchen.travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
driver:
name: digitalocean
region: nyc3
platforms:
- name: ubuntu-14-04-x64
- name: ubuntu-12-04-x64
Expand All @@ -12,6 +13,7 @@ platforms:
verifier:
sudo_command:
- name: centos-6-5-x64
- name: fedora-21-x64
- name: macosx
driver:
name: localhost
3 changes: 3 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ platforms:
- name: debian-7.8
- name: debian-6.0.10
- name: centos-6.6
- name: fedora-21
# - name: macosx-10.8
# - name: macosx-10.9
- name: macosx-10.10
Expand Down Expand Up @@ -43,10 +44,12 @@ suites:
- debian-7.8
- debian-6.0.10
- centos-6.6
- fedora-21
- macosx-10.10
- windows-2012
- ubuntu-12-04-x64
- debian-7-0-x64
- debian-6-0-x64
- centos-6-5-x64
- fedora-21-x64
- macosx
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ before_script:
- echo -e $DIGITALOCEAN_SSH_KEY_BODY > ~/.ssh/id_rsa

script:
- chef exec rake && chef exec kitchen test -c 4
- chef exec rake && chef exec kitchen test -c 5

after_script:
- chef exec kitchen destroy
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
Chef-DK Cookbook CHANGELOG
==========================

v?.?.? (????-??-??)
v3.1.0 (2015-06-03)
-------------------
* Add support for installing on Fedora, via [@joemiller][]

[@joemiller]: https://github.com/joemiller

v3.0.1 (2015-05-13)
-------------------
Expand Down
35 changes: 35 additions & 0 deletions libraries/provider_chef_dk_fedora.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Encoding: UTF-8
#
# Cookbook Name:: chef-dk
# Library:: provider_chef_dk_fedora
#
# Copyright 2014-2015 Jonathan Hartman
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require 'chef/provider'
require_relative 'provider_chef_dk'
require_relative 'provider_chef_dk_rhel'

class Chef
class Provider
class ChefDk < Provider
# A Chef-DK provider for Fedora, works exactly the same as RHEL.
#
# @author Jonathan Hartman <j@p4nt5.com>
class Fedora < ChefDk::Rhel
end
end
end
end
1 change: 1 addition & 0 deletions libraries/resource_chef_dk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
require_relative 'provider_chef_dk_debian'
require_relative 'provider_chef_dk_mac_os_x'
require_relative 'provider_chef_dk_rhel'
require_relative 'provider_chef_dk_fedora'
require_relative 'provider_chef_dk_windows'

class Chef
Expand Down
3 changes: 2 additions & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
license 'Apache v2.0'
description 'Installs/configures the Chef-DK'
long_description 'Installs/configures the Chef-DK'
version '3.0.2'
version '3.1.0'

depends 'dmg', '~> 2.2'

Expand All @@ -16,6 +16,7 @@
%w(redhat centos scientific amazon).each do |os|
supports os, '>= 6.0'
end
supports 'fedora'
supports 'mac_os_x', '>= 10.8'
supports 'windows'
# rubocop:enable SingleSpaceBeforeFirstArg
35 changes: 35 additions & 0 deletions spec/libraries/provider_chef_dk_fedora_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Encoding: UTF-8

require_relative '../spec_helper'
require_relative '../../libraries/provider_chef_dk_fedora'

describe Chef::Provider::ChefDk::Fedora do
let(:platform) { {} }
let(:chefdk_version) { nil }
let(:package_url) { nil }
let(:new_resource) do
double(name: 'my_chef_dk',
version: chefdk_version,
package_url: package_url)
end
let(:provider) { described_class.new(new_resource, nil) }

before(:each) do
allow_any_instance_of(described_class).to receive(:node).and_return(
Fauxhai.mock(platform).data
)
end

describe '#package_provider_class' do
it 'returns Chef::Provider::Package::Rpm' do
expected = Chef::Provider::Package::Rpm
expect(provider.send(:package_provider_class)).to eq(expected)
end
end

describe '#bashrc_file' do
it 'returns "bashrc"' do
expect(provider.send(:bashrc_file)).to eq('/etc/bashrc')
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
end

describe package('chefdk'),
if: %w(ubuntu debian redhat).include?(os[:family]) do
if: %w(ubuntu debian redhat fedora).include?(os[:family]) do
it 'is installed' do
expect(subject).to be_installed
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
end
end

describe file('/etc/bashrc'), if: %w(darwin redhat).include?(os[:family]) do
describe file('/etc/bashrc'),
if: %w(darwin redhat fedora).include?(os[:family]) do
it_behaves_like 'file with chef shell-init'
end

Expand Down