~ubuntu-branches/ubuntu/karmic/chef/karmic

« back to all changes in this revision

Viewing changes to chef/lib/chef/resource/ifconfig.rb

  • Committer: Bazaar Package Importer
  • Author(s): Joshua Timberman
  • Date: 2009-08-12 12:18:48 UTC
  • Revision ID: james.westby@ubuntu.com-20090812121848-yl38hpd7nfsl51xz
Tags: upstream-0.7.8
ImportĀ upstreamĀ versionĀ 0.7.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Author:: Jason K. Jackson (jason.jackson@monster.com)
 
3
# Copyright:: Copyright (c) 2009 Jason K. Jackson
 
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'
 
20
 
 
21
class Chef
 
22
  class Resource
 
23
    class Ifconfig < Chef::Resource
 
24
 
 
25
      def initialize(name, collection=nil, node=nil)
 
26
        super(name, collection, node)
 
27
        @resource_name = :ifconfig
 
28
        @target = name
 
29
        @action = :add
 
30
        @allowed_actions.push(:add, :delete)
 
31
        @hwaddr = nil
 
32
        @mask = nil
 
33
        @inet_addr = nil
 
34
        @bcast = nil
 
35
        @mtu = nil
 
36
        @metric = nil
 
37
        @device = nil 
 
38
        @onboot = nil
 
39
        @network = nil
 
40
        @bootproto = nil
 
41
      end
 
42
 
 
43
      def target(arg=nil)
 
44
        set_or_return(
 
45
          :target,
 
46
          arg,
 
47
          :kind_of => String
 
48
        )
 
49
      end
 
50
 
 
51
      def device(arg=nil)
 
52
        set_or_return(
 
53
          :device,
 
54
          arg,
 
55
          :kind_of => String
 
56
        )
 
57
      end
 
58
 
 
59
      def hwaddr(arg=nil)
 
60
        set_or_return(
 
61
          :hwaddr,
 
62
          arg,
 
63
          :kind_of => String
 
64
        )
 
65
      end
 
66
 
 
67
      def inet_addr(arg=nil)
 
68
        set_or_return(
 
69
          :inet_addr,
 
70
          arg,
 
71
          :kind_of => String
 
72
        )
 
73
      end
 
74
 
 
75
      def bcast(arg=nil)
 
76
        set_or_return(
 
77
          :bcast,
 
78
          arg,
 
79
          :kind_of => String
 
80
        )
 
81
      end
 
82
 
 
83
      def mask(arg=nil)
 
84
        set_or_return(
 
85
          :mask,
 
86
          arg,
 
87
          :kind_of => String
 
88
        )
 
89
      end
 
90
 
 
91
      def mtu(arg=nil)
 
92
        set_or_return(
 
93
          :mtu,
 
94
          arg,
 
95
          :kind_of => String
 
96
        )
 
97
      end
 
98
 
 
99
      def metric(arg=nil)
 
100
        set_or_return(
 
101
          :metric,
 
102
          arg,
 
103
          :kind_of => String
 
104
        )
 
105
      end
 
106
 
 
107
      def onboot(arg=nil)
 
108
        set_or_return(
 
109
          :onboot,
 
110
          arg,
 
111
          :kind_of => String
 
112
        )
 
113
      end
 
114
 
 
115
      def network(arg=nil)
 
116
        set_or_return(
 
117
          :network,
 
118
          arg,
 
119
          :kind_of => String
 
120
        )
 
121
      end
 
122
 
 
123
      def bootproto(arg=nil)
 
124
        set_or_return(
 
125
          :bootproto,
 
126
          arg,
 
127
          :kind_of => String
 
128
        )
 
129
      end
 
130
    end
 
131
  end
 
132
end
 
133
 
 
134