summaryrefslogtreecommitdiff
path: root/chef/lib/chef/resource
diff options
context:
space:
mode:
Diffstat (limited to 'chef/lib/chef/resource')
-rw-r--r--chef/lib/chef/resource/apt_package.rb33
-rw-r--r--chef/lib/chef/resource/bash.rb33
-rw-r--r--chef/lib/chef/resource/csh.rb33
-rw-r--r--chef/lib/chef/resource/directory.rb74
-rw-r--r--chef/lib/chef/resource/execute.rb133
-rw-r--r--chef/lib/chef/resource/file.rb82
-rw-r--r--chef/lib/chef/resource/gem_package.rb33
-rw-r--r--chef/lib/chef/resource/link.rb60
-rw-r--r--chef/lib/chef/resource/package.rb69
-rw-r--r--chef/lib/chef/resource/perl.rb33
-rw-r--r--chef/lib/chef/resource/portage_package.rb33
-rw-r--r--chef/lib/chef/resource/python.rb33
-rw-r--r--chef/lib/chef/resource/remote_directory.rb79
-rw-r--r--chef/lib/chef/resource/remote_file.rb41
-rw-r--r--chef/lib/chef/resource/ruby.rb33
-rw-r--r--chef/lib/chef/resource/script.rb51
-rw-r--r--chef/lib/chef/resource/service.rb113
-rw-r--r--chef/lib/chef/resource/sysctl.rb42
-rw-r--r--chef/lib/chef/resource/template.rb49
-rw-r--r--chef/lib/chef/resource/user.rb96
20 files changed, 1153 insertions, 0 deletions
diff --git a/chef/lib/chef/resource/apt_package.rb b/chef/lib/chef/resource/apt_package.rb
new file mode 100644
index 0000000000..58e8b14edc
--- /dev/null
+++ b/chef/lib/chef/resource/apt_package.rb
@@ -0,0 +1,33 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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 File.join(File.dirname(__FILE__), "package")
+
+class Chef
+ class Resource
+ class AptPackage < Chef::Resource::Package
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :apt_package
+ @provider = Chef::Provider::Package::Apt
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/bash.rb b/chef/lib/chef/resource/bash.rb
new file mode 100644
index 0000000000..7af5f9756a
--- /dev/null
+++ b/chef/lib/chef/resource/bash.rb
@@ -0,0 +1,33 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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 File.join(File.dirname(__FILE__), "script")
+
+class Chef
+ class Resource
+ class Bash < Chef::Resource::Script
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :bash
+ @interpreter = "bash"
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/csh.rb b/chef/lib/chef/resource/csh.rb
new file mode 100644
index 0000000000..29de9777b9
--- /dev/null
+++ b/chef/lib/chef/resource/csh.rb
@@ -0,0 +1,33 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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 File.join(File.dirname(__FILE__), "script")
+
+class Chef
+ class Resource
+ class Csh < Chef::Resource::Script
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :csh
+ @interpreter = "csh"
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/directory.rb b/chef/lib/chef/resource/directory.rb
new file mode 100644
index 0000000000..7e8944f5fc
--- /dev/null
+++ b/chef/lib/chef/resource/directory.rb
@@ -0,0 +1,74 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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.
+#
+
+class Chef
+ class Resource
+ class Directory < Chef::Resource
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :directory
+ @path = name
+ @action = :create
+ @recursive = false
+ @allowed_actions.push(:create, :delete)
+ end
+
+ def recursive(arg=nil)
+ set_or_return(
+ :recursive,
+ arg,
+ :kind_of => [ TrueClass, FalseClass ]
+ )
+ end
+
+ def group(arg=nil)
+ set_or_return(
+ :group,
+ arg,
+ :regex => [ /^([a-z]|[A-Z]|[0-9]|_|-)+$/, /^\d+$/ ]
+ )
+ end
+
+ def mode(arg=nil)
+ set_or_return(
+ :mode,
+ arg,
+ :regex => /^\d{3,4}$/
+ )
+ end
+
+ def owner(arg=nil)
+ set_or_return(
+ :owner,
+ arg,
+ :regex => [ /^([a-z]|[A-Z]|[0-9]|_|-)+$/, /^\d+$/ ]
+ )
+ end
+
+ def path(arg=nil)
+ set_or_return(
+ :path,
+ arg,
+ :kind_of => String
+ )
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/execute.rb b/chef/lib/chef/resource/execute.rb
new file mode 100644
index 0000000000..232cfe4d64
--- /dev/null
+++ b/chef/lib/chef/resource/execute.rb
@@ -0,0 +1,133 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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.
+#
+
+class Chef
+ class Resource
+ class Execute < Chef::Resource
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :execute
+ @command = name
+ @backup = 5
+ @action = "run"
+ @creates = nil
+ @cwd = nil
+ @environment = nil
+ @group = nil
+ @onlyif = nil
+ @path = nil
+ @notify_only = false
+ @returns = 0
+ @timeout = nil
+ @not_if = nil
+ @user = nil
+ @allowed_actions.push(:run)
+ end
+
+ def command(arg=nil)
+ set_or_return(
+ :command,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ def creates(arg=nil)
+ set_or_return(
+ :creates,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ def cwd(arg=nil)
+ set_or_return(
+ :cwd,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ def environment(arg=nil)
+ set_or_return(
+ :environment,
+ arg,
+ :kind_of => [ Hash ]
+ )
+ end
+
+ def group(arg=nil)
+ set_or_return(
+ :group,
+ arg,
+ :kind_of => [ String, Integer ]
+ )
+ end
+
+ def onlyif(arg=nil)
+ set_or_return(
+ :onlyif,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ def path(arg=nil)
+ set_or_return(
+ :path,
+ arg,
+ :kind_of => [ Array ]
+ )
+ end
+
+ def returns(arg=nil)
+ set_or_return(
+ :returns,
+ arg,
+ :kind_of => [ Integer ]
+ )
+ end
+
+ def timeout(arg=nil)
+ set_or_return(
+ :timeout,
+ arg,
+ :kind_of => [ Integer ]
+ )
+ end
+
+ def not_if(arg=nil)
+ set_or_return(
+ :not_if,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ def user(arg=nil)
+ set_or_return(
+ :user,
+ arg,
+ :kind_of => [ String, Integer ]
+ )
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/file.rb b/chef/lib/chef/resource/file.rb
new file mode 100644
index 0000000000..099bd76591
--- /dev/null
+++ b/chef/lib/chef/resource/file.rb
@@ -0,0 +1,82 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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.
+#
+
+class Chef
+ class Resource
+ class File < Chef::Resource
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :file
+ @path = name
+ @backup = 5
+ @action = "create"
+ @allowed_actions.push(:create, :delete, :touch)
+ end
+
+ def backup(arg=nil)
+ set_or_return(
+ :backup,
+ arg,
+ :kind_of => [ Integer, FalseClass ]
+ )
+ end
+
+ def checksum(arg=nil)
+ set_or_return(
+ :checksum,
+ arg,
+ :regex => /^[a-zA-Z0-9]{32}$/
+ )
+ end
+
+ def group(arg=nil)
+ set_or_return(
+ :group,
+ arg,
+ :regex => [ /^([a-z]|[A-Z]|[0-9]|_|-)+$/, /^\d+$/ ]
+ )
+ end
+
+ def mode(arg=nil)
+ set_or_return(
+ :mode,
+ arg,
+ :regex => /^\d{3,4}$/
+ )
+ end
+
+ def owner(arg=nil)
+ set_or_return(
+ :owner,
+ arg,
+ :regex => [ /^([a-z]|[A-Z]|[0-9]|_|-)+$/, /^\d+$/ ]
+ )
+ end
+
+ def path(arg=nil)
+ set_or_return(
+ :path,
+ arg,
+ :kind_of => String
+ )
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/gem_package.rb b/chef/lib/chef/resource/gem_package.rb
new file mode 100644
index 0000000000..1ec9463337
--- /dev/null
+++ b/chef/lib/chef/resource/gem_package.rb
@@ -0,0 +1,33 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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 File.join(File.dirname(__FILE__), "package")
+
+class Chef
+ class Resource
+ class GemPackage < Chef::Resource::Package
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :gem_package
+ @provider = Chef::Provider::Package::Rubygems
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/link.rb b/chef/lib/chef/resource/link.rb
new file mode 100644
index 0000000000..46b5793b0f
--- /dev/null
+++ b/chef/lib/chef/resource/link.rb
@@ -0,0 +1,60 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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.
+#
+
+class Chef
+ class Resource
+ class Link < Chef::Resource
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :link
+ @source_file = name
+ @action = :create
+ @link_type = :symbolic
+ @target_file = nil
+ @allowed_actions.push(:create, :delete)
+ end
+
+ def source_file(arg=nil)
+ set_or_return(
+ :source_file,
+ arg,
+ :kind_of => String
+ )
+ end
+
+ def target_file(arg=nil)
+ set_or_return(
+ :target_file,
+ arg,
+ :kind_of => String
+ )
+ end
+
+ def link_type(arg=nil)
+ real_arg = arg.kind_of?(String) ? arg.to_sym : arg
+ set_or_return(
+ :link_type,
+ real_arg,
+ :equal_to => [ :symbolic, :hard ]
+ )
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/package.rb b/chef/lib/chef/resource/package.rb
new file mode 100644
index 0000000000..f5f1c8418e
--- /dev/null
+++ b/chef/lib/chef/resource/package.rb
@@ -0,0 +1,69 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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.
+#
+
+class Chef
+ class Resource
+ class Package < Chef::Resource
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :package
+ @package_name = name
+ @version = nil
+ @candidate_version = nil
+ @response_file = nil
+ @source = nil
+ @action = "install"
+ @allowed_actions.push(:install, :upgrade, :remove, :purge)
+ end
+
+ def package_name(arg=nil)
+ set_or_return(
+ :package_name,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ def version(arg=nil)
+ set_or_return(
+ :version,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ def response_file(arg=nil)
+ set_or_return(
+ :response_file,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ def source(arg=nil)
+ set_or_return(
+ :source,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/perl.rb b/chef/lib/chef/resource/perl.rb
new file mode 100644
index 0000000000..a9b891ed5c
--- /dev/null
+++ b/chef/lib/chef/resource/perl.rb
@@ -0,0 +1,33 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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 File.join(File.dirname(__FILE__), "script")
+
+class Chef
+ class Resource
+ class Perl < Chef::Resource::Script
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :perl
+ @interpreter = "perl"
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/portage_package.rb b/chef/lib/chef/resource/portage_package.rb
new file mode 100644
index 0000000000..0e300da7a3
--- /dev/null
+++ b/chef/lib/chef/resource/portage_package.rb
@@ -0,0 +1,33 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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 File.join(File.dirname(__FILE__), "package")
+
+class Chef
+ class Resource
+ class PortagePackage < Chef::Resource::Package
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :portage_package
+ @provider = Chef::Provider::Package::Apt
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/python.rb b/chef/lib/chef/resource/python.rb
new file mode 100644
index 0000000000..ac2b27c00f
--- /dev/null
+++ b/chef/lib/chef/resource/python.rb
@@ -0,0 +1,33 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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 File.join(File.dirname(__FILE__), "script")
+
+class Chef
+ class Resource
+ class Python < Chef::Resource::Script
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :python
+ @interpreter = "python"
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/remote_directory.rb b/chef/lib/chef/resource/remote_directory.rb
new file mode 100644
index 0000000000..a23b39d42c
--- /dev/null
+++ b/chef/lib/chef/resource/remote_directory.rb
@@ -0,0 +1,79 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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.
+#
+
+class Chef
+ class Resource
+ class RemoteDirectory < Chef::Resource::Directory
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :remote_directory
+ @path = name
+ @delete = false
+ @action = :create
+ @recursive = true
+ @files_backup = 5
+ @files_owner = nil
+ @files_group = nil
+ @files_mode = 0644
+ @allowed_actions.push(:create, :delete)
+ end
+
+ def source(args=nil)
+ set_or_return(
+ :source,
+ args,
+ :kind_of => String
+ )
+ end
+
+ def files_backup(arg=nil)
+ set_or_return(
+ :files_backup,
+ arg,
+ :kind_of => [ Integer, FalseClass ]
+ )
+ end
+
+ def files_group(arg=nil)
+ set_or_return(
+ :files_group,
+ arg,
+ :regex => [ /^([a-z]|[A-Z]|[0-9]|_|-)+$/, /^\d+$/ ]
+ )
+ end
+
+ def files_mode(arg=nil)
+ set_or_return(
+ :files_mode,
+ arg,
+ :regex => /^\d{3,4}$/
+ )
+ end
+
+ def files_owner(arg=nil)
+ set_or_return(
+ :files_owner,
+ arg,
+ :regex => [ /^([a-z]|[A-Z]|[0-9]|_|-)+$/, /^\d+$/ ]
+ )
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/remote_file.rb b/chef/lib/chef/resource/remote_file.rb
new file mode 100644
index 0000000000..dace234398
--- /dev/null
+++ b/chef/lib/chef/resource/remote_file.rb
@@ -0,0 +1,41 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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.
+#
+
+class Chef
+ class Resource
+ class RemoteFile < Chef::Resource::File
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :remote_file
+ @action = "create"
+ @source = nil
+ @variables = Hash.new
+ end
+
+ def source(args=nil)
+ set_or_return(
+ :source,
+ args,
+ :kind_of => String
+ )
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/ruby.rb b/chef/lib/chef/resource/ruby.rb
new file mode 100644
index 0000000000..591f1a658b
--- /dev/null
+++ b/chef/lib/chef/resource/ruby.rb
@@ -0,0 +1,33 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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 File.join(File.dirname(__FILE__), "script")
+
+class Chef
+ class Resource
+ class Ruby < Chef::Resource::Script
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :ruby
+ @interpreter = "ruby"
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/script.rb b/chef/lib/chef/resource/script.rb
new file mode 100644
index 0000000000..d59882ab9c
--- /dev/null
+++ b/chef/lib/chef/resource/script.rb
@@ -0,0 +1,51 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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 File.join(File.dirname(__FILE__), "execute")
+
+class Chef
+ class Resource
+ class Script < Chef::Resource::Execute
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :script
+ @command = name
+ @code = nil
+ @interpreter = nil
+ end
+
+ def code(arg=nil)
+ set_or_return(
+ :code,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ def interpreter(arg=nil)
+ set_or_return(
+ :interpreter,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/service.rb b/chef/lib/chef/resource/service.rb
new file mode 100644
index 0000000000..1c9a784745
--- /dev/null
+++ b/chef/lib/chef/resource/service.rb
@@ -0,0 +1,113 @@
+#
+# Author:: AJ Christensen (<aj@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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.
+#
+
+class Chef
+ class Resource
+ class Service < Chef::Resource
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :service
+ @service_name = name
+ @enabled = nil
+ @running = nil
+ @pattern = service_name
+ @start_command = nil
+ @stop_command = nil
+ @status_command = nil
+ @restart_command = nil
+ @action = "none"
+ @supports = { :restart => false, :status => false }
+ @allowed_actions.push(:enable, :disable, :start, :stop)
+ end
+
+ def service_name(arg=nil)
+ set_or_return(
+ :service_name,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ # regex for match against ps -ef when !supports[:has_status] && status == nil
+ def pattern(arg=nil)
+ set_or_return(
+ :pattern,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ # command to call to start service
+ def start_command(arg=nil)
+ set_or_return(
+ :start_command,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ # command to call to stop service
+ def stop_command(arg=nil)
+ set_or_return(
+ :stop_command,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ # command to call to get status of service
+ def status_command(arg=nil)
+ set_or_return(
+ :status_command,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ # command to call to restart service
+ def restart_command(arg=nil)
+ set_or_return(
+ :restart_command,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ # if the service is enabled or not
+ def enabled(arg=nil)
+ set_or_return(
+ :enabled,
+ arg,
+ :kind_of => [ TrueClass, FalseClass ]
+ )
+ end
+
+ # if the service is running or not
+ def running(arg=nil)
+ set_or_return(
+ :running,
+ arg,
+ :kind_of => [ TrueClass, FalseClass ]
+ )
+ end
+
+
+ end
+ end
+end
diff --git a/chef/lib/chef/resource/sysctl.rb b/chef/lib/chef/resource/sysctl.rb
new file mode 100644
index 0000000000..203ad72425
--- /dev/null
+++ b/chef/lib/chef/resource/sysctl.rb
@@ -0,0 +1,42 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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.
+#
+
+class Chef
+ class Resource
+ class Sysctl < Chef::Resource
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :sysctl
+ @action = "set"
+ @name = name
+ @value = nil
+ @variables = Hash.new
+ end
+
+ def value(args=nil)
+ set_or_return(
+ :value,
+ args,
+ :kind_of => String
+ )
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/template.rb b/chef/lib/chef/resource/template.rb
new file mode 100644
index 0000000000..5f2512a274
--- /dev/null
+++ b/chef/lib/chef/resource/template.rb
@@ -0,0 +1,49 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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.
+#
+
+class Chef
+ class Resource
+ class Template < Chef::Resource::File
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :template
+ @action = "create"
+ @source = nil
+ @variables = Hash.new
+ end
+
+ def source(file=nil)
+ set_or_return(
+ :source,
+ file,
+ :kind_of => [ String ]
+ )
+ end
+
+ def variables(args=nil)
+ set_or_return(
+ :variables,
+ args,
+ :kind_of => [ Hash ]
+ )
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/chef/lib/chef/resource/user.rb b/chef/lib/chef/resource/user.rb
new file mode 100644
index 0000000000..1702753408
--- /dev/null
+++ b/chef/lib/chef/resource/user.rb
@@ -0,0 +1,96 @@
+#
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: Apache License, Version 2.0
+#
+# 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.
+#
+
+class Chef
+ class Resource
+ class User < Chef::Resource
+
+ def initialize(name, collection=nil, node=nil)
+ super(name, collection, node)
+ @resource_name = :user
+ @username = name
+ @comment = nil
+ @uid = nil
+ @gid = nil
+ @home = nil
+ @shell = nil
+ @password = nil
+ @action = :create
+ @supports = { :manage_home => false }
+ @allowed_actions.push(:create, :remove, :modify, :manage, :lock, :unlock)
+ end
+
+ def username(arg=nil)
+ set_or_return(
+ :username,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ def comment(arg=nil)
+ set_or_return(
+ :comment,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ def uid(arg=nil)
+ set_or_return(
+ :uid,
+ arg,
+ :kind_of => [ String, Integer ]
+ )
+ end
+
+ def gid(arg=nil)
+ set_or_return(
+ :gid,
+ arg,
+ :kind_of => [ String, Integer ]
+ )
+ end
+
+ def home(arg=nil)
+ set_or_return(
+ :home,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ def shell(arg=nil)
+ set_or_return(
+ :shell,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ def password(arg=nil)
+ set_or_return(
+ :password,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
+ end
+ end
+end \ No newline at end of file