Skip to content

Commit 035a47a

Browse files
thbishopdanielsdeleo
authored andcommitted
[CHEF-1422] enable the ability to use rpm_package as a shortcut resource
1 parent 7b3c171 commit 035a47a

3 files changed

Lines changed: 73 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# Author:: Adam Jacob (<adam@opscode.com>)
3+
# Copyright:: Copyright (c) 2008 Opscode, Inc.
4+
# License:: Apache License, Version 2.0
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
require 'chef/resource/package'
20+
require 'chef/provider/package/rpm'
21+
22+
class Chef
23+
class Resource
24+
class RpmPackage < Chef::Resource::Package
25+
26+
def initialize(name, run_context=nil)
27+
super
28+
@resource_name = :rpm_package
29+
@provider = Chef::Provider::Package::Rpm
30+
end
31+
32+
end
33+
end
34+
end

chef/lib/chef/resources.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
require 'chef/resource/python'
5050
require 'chef/resource/remote_directory'
5151
require 'chef/resource/remote_file'
52+
require 'chef/resource/rpm_package'
5253
require 'chef/resource/route'
5354
require 'chef/resource/ruby'
5455
require 'chef/resource/ruby_block'
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#
2+
# Author:: Adam Jacob (<adam@opscode.com>)
3+
# Copyright:: Copyright (c) 2008 Opscode, Inc.
4+
# License:: Apache License, Version 2.0
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper"))
20+
21+
describe Chef::Resource::RpmPackage, "initialize" do
22+
23+
before(:each) do
24+
@resource = Chef::Resource::RpmPackage.new("foo")
25+
end
26+
27+
it "should return a Chef::Resource::RpmPackage" do
28+
@resource.should be_a_kind_of(Chef::Resource::RpmPackage)
29+
end
30+
31+
it "should set the resource_name to :rpm_package" do
32+
@resource.resource_name.should eql(:rpm_package)
33+
end
34+
35+
it "should set the provider to Chef::Provider::Package::Rpm" do
36+
@resource.provider.should eql(Chef::Provider::Package::Rpm)
37+
end
38+
end

0 commit comments

Comments
 (0)