giraffesoft-chef 0.7.15
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +201 -0
- data/README.rdoc +135 -0
- data/bin/chef-client +26 -0
- data/bin/chef-solo +26 -0
- data/distro/debian/etc/init.d/chef-client +175 -0
- data/distro/debian/etc/init.d/chef-indexer +175 -0
- data/distro/debian/etc/init.d/chef-server +120 -0
- data/distro/debian/man/man1/chef-indexer.1 +42 -0
- data/distro/debian/man/man1/chef-server.1 +108 -0
- data/distro/debian/man/man8/chef-client.8 +61 -0
- data/distro/debian/man/man8/chef-solo.8 +58 -0
- data/distro/redhat/etc/chef/client.rb +16 -0
- data/distro/redhat/etc/chef/indexer.rb +10 -0
- data/distro/redhat/etc/chef/server.rb +22 -0
- data/distro/redhat/etc/init.d/chef-client +74 -0
- data/distro/redhat/etc/init.d/chef-indexer +76 -0
- data/distro/redhat/etc/init.d/chef-server +77 -0
- data/lib/chef.rb +49 -0
- data/lib/chef/application.rb +98 -0
- data/lib/chef/application/agent.rb +18 -0
- data/lib/chef/application/client.rb +209 -0
- data/lib/chef/application/indexer.rb +141 -0
- data/lib/chef/application/server.rb +18 -0
- data/lib/chef/application/solo.rb +214 -0
- data/lib/chef/client.rb +421 -0
- data/lib/chef/compile.rb +170 -0
- data/lib/chef/config.rb +141 -0
- data/lib/chef/cookbook.rb +171 -0
- data/lib/chef/cookbook/metadata.rb +407 -0
- data/lib/chef/cookbook/metadata/version.rb +87 -0
- data/lib/chef/cookbook_loader.rb +180 -0
- data/lib/chef/couchdb.rb +176 -0
- data/lib/chef/daemon.rb +170 -0
- data/lib/chef/exceptions.rb +36 -0
- data/lib/chef/file_cache.rb +205 -0
- data/lib/chef/log.rb +39 -0
- data/lib/chef/mixin/check_helper.rb +31 -0
- data/lib/chef/mixin/checksum.rb +37 -0
- data/lib/chef/mixin/command.rb +386 -0
- data/lib/chef/mixin/convert_to_class_name.rb +48 -0
- data/lib/chef/mixin/create_path.rb +56 -0
- data/lib/chef/mixin/deep_merge.rb +36 -0
- data/lib/chef/mixin/find_preferred_file.rb +92 -0
- data/lib/chef/mixin/from_file.rb +50 -0
- data/lib/chef/mixin/generate_url.rb +49 -0
- data/lib/chef/mixin/language.rb +79 -0
- data/lib/chef/mixin/params_validate.rb +197 -0
- data/lib/chef/mixin/recipe_definition_dsl_core.rb +77 -0
- data/lib/chef/mixin/template.rb +84 -0
- data/lib/chef/node.rb +406 -0
- data/lib/chef/node/attribute.rb +412 -0
- data/lib/chef/openid_registration.rb +181 -0
- data/lib/chef/platform.rb +254 -0
- data/lib/chef/provider.rb +101 -0
- data/lib/chef/provider/cron.rb +187 -0
- data/lib/chef/provider/deploy.rb +281 -0
- data/lib/chef/provider/deploy/revision.rb +70 -0
- data/lib/chef/provider/deploy/timestamped.rb +33 -0
- data/lib/chef/provider/directory.rb +72 -0
- data/lib/chef/provider/execute.rb +58 -0
- data/lib/chef/provider/file.rb +191 -0
- data/lib/chef/provider/git.rb +198 -0
- data/lib/chef/provider/group.rb +120 -0
- data/lib/chef/provider/group/gpasswd.rb +50 -0
- data/lib/chef/provider/group/groupadd.rb +78 -0
- data/lib/chef/provider/group/pw.rb +88 -0
- data/lib/chef/provider/group/usermod.rb +57 -0
- data/lib/chef/provider/http_request.rb +102 -0
- data/lib/chef/provider/ifconfig.rb +131 -0
- data/lib/chef/provider/link.rb +157 -0
- data/lib/chef/provider/mount.rb +117 -0
- data/lib/chef/provider/mount/mount.rb +208 -0
- data/lib/chef/provider/package.rb +160 -0
- data/lib/chef/provider/package/apt.rb +110 -0
- data/lib/chef/provider/package/dpkg.rb +109 -0
- data/lib/chef/provider/package/freebsd.rb +153 -0
- data/lib/chef/provider/package/macports.rb +105 -0
- data/lib/chef/provider/package/portage.rb +124 -0
- data/lib/chef/provider/package/rpm.rb +99 -0
- data/lib/chef/provider/package/rubygems.rb +136 -0
- data/lib/chef/provider/package/yum-dump.py +106 -0
- data/lib/chef/provider/package/yum.rb +175 -0
- data/lib/chef/provider/remote_directory.rb +126 -0
- data/lib/chef/provider/remote_file.rb +141 -0
- data/lib/chef/provider/route.rb +118 -0
- data/lib/chef/provider/ruby_block.rb +15 -0
- data/lib/chef/provider/script.rb +42 -0
- data/lib/chef/provider/service.rb +135 -0
- data/lib/chef/provider/service/debian.rb +64 -0
- data/lib/chef/provider/service/freebsd.rb +157 -0
- data/lib/chef/provider/service/gentoo.rb +54 -0
- data/lib/chef/provider/service/init.rb +71 -0
- data/lib/chef/provider/service/redhat.rb +62 -0
- data/lib/chef/provider/service/simple.rb +115 -0
- data/lib/chef/provider/subversion.rb +148 -0
- data/lib/chef/provider/template.rb +143 -0
- data/lib/chef/provider/user.rb +170 -0
- data/lib/chef/provider/user/pw.rb +113 -0
- data/lib/chef/provider/user/useradd.rb +107 -0
- data/lib/chef/queue.rb +145 -0
- data/lib/chef/recipe.rb +144 -0
- data/lib/chef/resource.rb +380 -0
- data/lib/chef/resource/apt_package.rb +34 -0
- data/lib/chef/resource/bash.rb +33 -0
- data/lib/chef/resource/cron.rb +179 -0
- data/lib/chef/resource/csh.rb +33 -0
- data/lib/chef/resource/deploy.rb +350 -0
- data/lib/chef/resource/deploy_revision.rb +35 -0
- data/lib/chef/resource/directory.rb +76 -0
- data/lib/chef/resource/dpkg_package.rb +34 -0
- data/lib/chef/resource/execute.rb +127 -0
- data/lib/chef/resource/file.rb +84 -0
- data/lib/chef/resource/gem_package.rb +41 -0
- data/lib/chef/resource/git.rb +36 -0
- data/lib/chef/resource/group.rb +70 -0
- data/lib/chef/resource/http_request.rb +52 -0
- data/lib/chef/resource/ifconfig.rb +134 -0
- data/lib/chef/resource/link.rb +78 -0
- data/lib/chef/resource/macports_package.rb +29 -0
- data/lib/chef/resource/mount.rb +135 -0
- data/lib/chef/resource/package.rb +80 -0
- data/lib/chef/resource/perl.rb +33 -0
- data/lib/chef/resource/portage_package.rb +33 -0
- data/lib/chef/resource/python.rb +33 -0
- data/lib/chef/resource/remote_directory.rb +91 -0
- data/lib/chef/resource/remote_file.rb +60 -0
- data/lib/chef/resource/route.rb +135 -0
- data/lib/chef/resource/ruby.rb +33 -0
- data/lib/chef/resource/ruby_block.rb +20 -0
- data/lib/chef/resource/scm.rb +129 -0
- data/lib/chef/resource/script.rb +51 -0
- data/lib/chef/resource/service.rb +134 -0
- data/lib/chef/resource/subversion.rb +33 -0
- data/lib/chef/resource/template.rb +60 -0
- data/lib/chef/resource/timestamped_deploy.rb +31 -0
- data/lib/chef/resource/user.rb +98 -0
- data/lib/chef/resource_collection.rb +204 -0
- data/lib/chef/resource_definition.rb +67 -0
- data/lib/chef/rest.rb +238 -0
- data/lib/chef/role.rb +231 -0
- data/lib/chef/run_list.rb +156 -0
- data/lib/chef/runner.rb +130 -0
- data/lib/chef/search.rb +88 -0
- data/lib/chef/search/result.rb +64 -0
- data/lib/chef/search_index.rb +77 -0
- data/lib/chef/tasks/chef_repo.rake +347 -0
- data/lib/chef/util/file_edit.rb +125 -0
- data/lib/chef/util/fileedit.rb +121 -0
- metadata +293 -0
@@ -0,0 +1,129 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Daniel DeLeo (<dan@kallistec.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
|
+
|
20
|
+
require 'chef/resource'
|
21
|
+
|
22
|
+
class Chef
|
23
|
+
class Resource
|
24
|
+
class Scm < Chef::Resource
|
25
|
+
|
26
|
+
def initialize(name, collection=nil, node=nil)
|
27
|
+
super(name, collection, node)
|
28
|
+
@destination = name
|
29
|
+
@resource_name = :scm
|
30
|
+
@enable_submodules = false
|
31
|
+
@revision = "HEAD"
|
32
|
+
@remote = "origin"
|
33
|
+
@ssh_wrapper = nil
|
34
|
+
@depth = nil
|
35
|
+
@allowed_actions.push(:checkout, :export, :sync, :diff, :log)
|
36
|
+
end
|
37
|
+
|
38
|
+
def destination(arg=nil)
|
39
|
+
set_or_return(
|
40
|
+
:destination,
|
41
|
+
arg,
|
42
|
+
:kind_of => String
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
def repository(arg=nil)
|
47
|
+
set_or_return(
|
48
|
+
:repository,
|
49
|
+
arg,
|
50
|
+
:kind_of => String
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
def revision(arg=nil)
|
55
|
+
set_or_return(
|
56
|
+
:revision,
|
57
|
+
arg,
|
58
|
+
:kind_of => String
|
59
|
+
)
|
60
|
+
end
|
61
|
+
|
62
|
+
def user(arg=nil)
|
63
|
+
set_or_return(
|
64
|
+
:user,
|
65
|
+
arg,
|
66
|
+
:kind_of => [String, Integer]
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
def svn_username(arg=nil)
|
71
|
+
set_or_return(
|
72
|
+
:svn_username,
|
73
|
+
arg,
|
74
|
+
:kind_of => String
|
75
|
+
)
|
76
|
+
end
|
77
|
+
|
78
|
+
def svn_password(arg=nil)
|
79
|
+
set_or_return(
|
80
|
+
:svn_password,
|
81
|
+
arg,
|
82
|
+
:kind_of => String
|
83
|
+
)
|
84
|
+
end
|
85
|
+
|
86
|
+
def svn_arguments(arg=nil)
|
87
|
+
set_or_return(
|
88
|
+
:svn_arguments,
|
89
|
+
arg,
|
90
|
+
:kind_of => String
|
91
|
+
)
|
92
|
+
end
|
93
|
+
|
94
|
+
# Capistrano and git-deploy use ``shallow clone''
|
95
|
+
def depth(arg=nil)
|
96
|
+
set_or_return(
|
97
|
+
:depth,
|
98
|
+
arg,
|
99
|
+
:kind_of => Integer
|
100
|
+
)
|
101
|
+
end
|
102
|
+
|
103
|
+
def enable_submodules(arg=nil)
|
104
|
+
set_or_return(
|
105
|
+
:enable_submodules,
|
106
|
+
arg,
|
107
|
+
:kind_of => [TrueClass, FalseClass]
|
108
|
+
)
|
109
|
+
end
|
110
|
+
|
111
|
+
def remote(arg=nil)
|
112
|
+
set_or_return(
|
113
|
+
:remote,
|
114
|
+
arg,
|
115
|
+
:kind_of => String
|
116
|
+
)
|
117
|
+
end
|
118
|
+
|
119
|
+
def ssh_wrapper(arg=nil)
|
120
|
+
set_or_return(
|
121
|
+
:ssh_wrapper,
|
122
|
+
arg,
|
123
|
+
:kind_of => String
|
124
|
+
)
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,51 @@
|
|
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/execute'
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class Resource
|
23
|
+
class Script < Chef::Resource::Execute
|
24
|
+
|
25
|
+
def initialize(name, collection=nil, node=nil)
|
26
|
+
super(name, collection, node)
|
27
|
+
@resource_name = :script
|
28
|
+
@command = name
|
29
|
+
@code = nil
|
30
|
+
@interpreter = nil
|
31
|
+
end
|
32
|
+
|
33
|
+
def code(arg=nil)
|
34
|
+
set_or_return(
|
35
|
+
:code,
|
36
|
+
arg,
|
37
|
+
:kind_of => [ String ]
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
def interpreter(arg=nil)
|
42
|
+
set_or_return(
|
43
|
+
:interpreter,
|
44
|
+
arg,
|
45
|
+
:kind_of => [ String ]
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
#
|
2
|
+
# Author:: AJ Christensen (<aj@hjksolutions.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'
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class Resource
|
23
|
+
class Service < Chef::Resource
|
24
|
+
|
25
|
+
def initialize(name, collection=nil, node=nil)
|
26
|
+
super(name, collection, node)
|
27
|
+
@resource_name = :service
|
28
|
+
@service_name = name
|
29
|
+
@enabled = nil
|
30
|
+
@running = nil
|
31
|
+
@pattern = service_name
|
32
|
+
@start_command = nil
|
33
|
+
@stop_command = nil
|
34
|
+
@status_command = nil
|
35
|
+
@restart_command = nil
|
36
|
+
@reload_command = nil
|
37
|
+
@action = "nothing"
|
38
|
+
@supports = { :restart => false, :reload => false, :status => false }
|
39
|
+
@allowed_actions.push(:enable, :disable, :start, :stop, :restart, :reload)
|
40
|
+
end
|
41
|
+
|
42
|
+
def service_name(arg=nil)
|
43
|
+
set_or_return(
|
44
|
+
:service_name,
|
45
|
+
arg,
|
46
|
+
:kind_of => [ String ]
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
# regex for match against ps -ef when !supports[:has_status] && status == nil
|
51
|
+
def pattern(arg=nil)
|
52
|
+
set_or_return(
|
53
|
+
:pattern,
|
54
|
+
arg,
|
55
|
+
:kind_of => [ String ]
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
# command to call to start service
|
60
|
+
def start_command(arg=nil)
|
61
|
+
set_or_return(
|
62
|
+
:start_command,
|
63
|
+
arg,
|
64
|
+
:kind_of => [ String ]
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
# command to call to stop service
|
69
|
+
def stop_command(arg=nil)
|
70
|
+
set_or_return(
|
71
|
+
:stop_command,
|
72
|
+
arg,
|
73
|
+
:kind_of => [ String ]
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
77
|
+
# command to call to get status of service
|
78
|
+
def status_command(arg=nil)
|
79
|
+
set_or_return(
|
80
|
+
:status_command,
|
81
|
+
arg,
|
82
|
+
:kind_of => [ String ]
|
83
|
+
)
|
84
|
+
end
|
85
|
+
|
86
|
+
# command to call to restart service
|
87
|
+
def restart_command(arg=nil)
|
88
|
+
set_or_return(
|
89
|
+
:restart_command,
|
90
|
+
arg,
|
91
|
+
:kind_of => [ String ]
|
92
|
+
)
|
93
|
+
end
|
94
|
+
|
95
|
+
def reload_command(arg=nil)
|
96
|
+
set_or_return(
|
97
|
+
:reload_command,
|
98
|
+
arg,
|
99
|
+
:kind_of => [ String ]
|
100
|
+
)
|
101
|
+
end
|
102
|
+
|
103
|
+
# if the service is enabled or not
|
104
|
+
def enabled(arg=nil)
|
105
|
+
set_or_return(
|
106
|
+
:enabled,
|
107
|
+
arg,
|
108
|
+
:kind_of => [ TrueClass, FalseClass ]
|
109
|
+
)
|
110
|
+
end
|
111
|
+
|
112
|
+
# if the service is running or not
|
113
|
+
def running(arg=nil)
|
114
|
+
set_or_return(
|
115
|
+
:running,
|
116
|
+
arg,
|
117
|
+
:kind_of => [ TrueClass, FalseClass ]
|
118
|
+
)
|
119
|
+
end
|
120
|
+
|
121
|
+
def supports(args={})
|
122
|
+
if args.is_a? Array
|
123
|
+
args.each { |arg| @supports[arg] = true }
|
124
|
+
elsif args.any?
|
125
|
+
@supports = args
|
126
|
+
else
|
127
|
+
@supports
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Daniel DeLeo (<dan@kallistec.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/scm"
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class Resource
|
23
|
+
class Subversion < Chef::Resource::Scm
|
24
|
+
|
25
|
+
def initialize(name, collection=nil, node=nil)
|
26
|
+
super(name, collection, node)
|
27
|
+
@resource_name = :subversion
|
28
|
+
@provider = Chef::Provider::Subversion
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,60 @@
|
|
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/file'
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class Resource
|
23
|
+
class Template < Chef::Resource::File
|
24
|
+
|
25
|
+
def initialize(name, collection=nil, node=nil)
|
26
|
+
super(name, collection, node)
|
27
|
+
@resource_name = :template
|
28
|
+
@action = "create"
|
29
|
+
@source = "#{::File.basename(name)}.erb"
|
30
|
+
@cookbook = nil
|
31
|
+
@variables = Hash.new
|
32
|
+
end
|
33
|
+
|
34
|
+
def source(file=nil)
|
35
|
+
set_or_return(
|
36
|
+
:source,
|
37
|
+
file,
|
38
|
+
:kind_of => [ String ]
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def variables(args=nil)
|
43
|
+
set_or_return(
|
44
|
+
:variables,
|
45
|
+
args,
|
46
|
+
:kind_of => [ Hash ]
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
def cookbook(args=nil)
|
51
|
+
set_or_return(
|
52
|
+
:cookbook,
|
53
|
+
args,
|
54
|
+
:kind_of => [ String ]
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Daniel DeLeo (<dan@kallistec.com>)
|
3
|
+
# Copyright:: Copyright (c) 2009 Daniel DeLeo
|
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
|
+
class Chef
|
20
|
+
class Resource
|
21
|
+
|
22
|
+
# Convenience class for using the deploy resource with the timestamped
|
23
|
+
# deployment strategy (provider)
|
24
|
+
class TimestampedDeploy < Chef::Resource::Deploy
|
25
|
+
def initialize(*args, &block)
|
26
|
+
super(*args, &block)
|
27
|
+
@provider = Chef::Provider::Deploy::Timestamped
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,98 @@
|
|
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'
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class Resource
|
23
|
+
class User < Chef::Resource
|
24
|
+
|
25
|
+
def initialize(name, collection=nil, node=nil)
|
26
|
+
super(name, collection, node)
|
27
|
+
@resource_name = :user
|
28
|
+
@username = name
|
29
|
+
@comment = nil
|
30
|
+
@uid = nil
|
31
|
+
@gid = nil
|
32
|
+
@home = nil
|
33
|
+
@shell = nil
|
34
|
+
@password = nil
|
35
|
+
@action = :create
|
36
|
+
@supports = { :manage_home => false }
|
37
|
+
@allowed_actions.push(:create, :remove, :modify, :manage, :lock, :unlock)
|
38
|
+
end
|
39
|
+
|
40
|
+
def username(arg=nil)
|
41
|
+
set_or_return(
|
42
|
+
:username,
|
43
|
+
arg,
|
44
|
+
:kind_of => [ String ]
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def comment(arg=nil)
|
49
|
+
set_or_return(
|
50
|
+
:comment,
|
51
|
+
arg,
|
52
|
+
:kind_of => [ String ]
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
def uid(arg=nil)
|
57
|
+
set_or_return(
|
58
|
+
:uid,
|
59
|
+
arg,
|
60
|
+
:kind_of => [ String, Integer ]
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
def gid(arg=nil)
|
65
|
+
set_or_return(
|
66
|
+
:gid,
|
67
|
+
arg,
|
68
|
+
:kind_of => [ String, Integer ]
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
72
|
+
def home(arg=nil)
|
73
|
+
set_or_return(
|
74
|
+
:home,
|
75
|
+
arg,
|
76
|
+
:kind_of => [ String ]
|
77
|
+
)
|
78
|
+
end
|
79
|
+
|
80
|
+
def shell(arg=nil)
|
81
|
+
set_or_return(
|
82
|
+
:shell,
|
83
|
+
arg,
|
84
|
+
:kind_of => [ String ]
|
85
|
+
)
|
86
|
+
end
|
87
|
+
|
88
|
+
def password(arg=nil)
|
89
|
+
set_or_return(
|
90
|
+
:password,
|
91
|
+
arg,
|
92
|
+
:kind_of => [ String ]
|
93
|
+
)
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|