summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-06-29 21:16:54 +0000
committerLuke Kanies <luke@madstop.com>2005-06-29 21:16:54 +0000
commit3441b82f84ff7dbc15e9a9d3c20da84a7eae8ce5 (patch)
tree2938f0ff110748a0ea61adafd84880b293902d07
parentf250d920627696bab766dffe6c8e6a8983298fc6 (diff)
downloadpuppet-3441b82f84ff7dbc15e9a9d3c20da84a7eae8ce5.tar.gz
puppet-3441b82f84ff7dbc15e9a9d3c20da84a7eae8ce5.tar.xz
puppet-3441b82f84ff7dbc15e9a9d3c20da84a7eae8ce5.zip
finishing rename of file class
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@323 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--lib/puppet/type.rb2
-rw-r--r--lib/puppet/type/pfile.rb50
-rw-r--r--lib/puppet/type/pprocess.rb10
-rw-r--r--lib/puppet/type/symlink.rb8
-rw-r--r--test/other/tc_metrics.rb2
-rw-r--r--test/other/tc_state.rb2
-rw-r--r--test/other/tc_transactions.rb6
-rw-r--r--test/types/tc_basic.rb2
-rw-r--r--test/types/tc_file.rb10
-rw-r--r--test/types/tc_query.rb6
10 files changed, 49 insertions, 49 deletions
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index 0eee5dbe0..2ec09dc81 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -875,7 +875,7 @@ end # Puppet::Type
end
require 'puppet/type/service'
-require 'puppet/type/file'
+require 'puppet/type/pfile'
require 'puppet/type/symlink'
require 'puppet/type/package'
require 'puppet/type/component'
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb
index 28ac59447..e8d459fe6 100644
--- a/lib/puppet/type/pfile.rb
+++ b/lib/puppet/type/pfile.rb
@@ -11,7 +11,7 @@ module Puppet
# because the objects must be defined for us to use them in our
# definition of the file object
class State
- class FileCreate < Puppet::State
+ class PFileCreate < Puppet::State
require 'etc'
attr_accessor :file
@name = :create
@@ -45,7 +45,7 @@ module Puppet
end
end
- class FileChecksum < Puppet::State
+ class PFileChecksum < Puppet::State
@name = :checksum
@event = :file_modified
@@ -122,7 +122,7 @@ module Puppet
end
end
- class FileUID < Puppet::State
+ class PFileUID < Puppet::State
require 'etc'
attr_accessor :file
@name = :owner
@@ -159,7 +159,7 @@ module Puppet
end
unless self.parent.stat
- Puppet.err "File '%s' does not exist; cannot chown" %
+ Puppet.err "PFile '%s' does not exist; cannot chown" %
self.parent[:path]
end
@@ -177,7 +177,7 @@ module Puppet
# this state should actually somehow turn into many states,
# one for each bit in the mode
# I think MetaStates are the answer, but I'm not quite sure
- class FileMode < Puppet::State
+ class PFileMode < Puppet::State
require 'etc'
@name = :mode
@@ -210,7 +210,7 @@ module Puppet
end
unless self.parent.stat
- Puppet.err "File '%s' does not exist; cannot chmod" %
+ Puppet.err "PFile '%s' does not exist; cannot chmod" %
self.parent[:path]
return
end
@@ -226,10 +226,10 @@ module Puppet
# not used until I can figure out how to solve the problem with
# metastates
- class FileSetUID < Puppet::State
+ class PFileSetUID < Puppet::State
require 'etc'
- @parent = Puppet::State::FileMode
+ @parent = Puppet::State::PFileMode
@name = :setuid
@event = :inode_changed
@@ -254,7 +254,7 @@ module Puppet
end
end
- class FileGroup < Puppet::State
+ class PFileGroup < Puppet::State
require 'etc'
@name = :group
@@ -307,7 +307,7 @@ module Puppet
end
unless self.parent.stat
- Puppet.err "File '%s' does not exist; cannot chgrp" %
+ Puppet.err "PFile '%s' does not exist; cannot chgrp" %
self.parent[:path]
return
end
@@ -324,16 +324,16 @@ module Puppet
end
end
class Type
- class File < Type
+ class PFile < Type
attr_reader :params
# class instance variable
@states = [
- Puppet::State::FileCreate,
- Puppet::State::FileUID,
- Puppet::State::FileGroup,
- Puppet::State::FileMode,
- Puppet::State::FileChecksum,
- Puppet::State::FileSetUID
+ Puppet::State::PFileCreate,
+ Puppet::State::PFileUID,
+ Puppet::State::PFileGroup,
+ Puppet::State::PFileMode,
+ Puppet::State::PFileChecksum,
+ Puppet::State::PFileSetUID
]
@parameters = [
@@ -347,7 +347,7 @@ module Puppet
# a wrapper method to make sure the file exists before doing anything
def retrieve
unless stat = self.stat(true)
- Puppet.debug "File %s does not exist" % self[:path]
+ Puppet.debug "PFile %s does not exist" % self[:path]
@states.each { |name,state|
state.is = -1
}
@@ -359,7 +359,7 @@ module Puppet
def stat(refresh = false)
if @stat.nil? or refresh == true
begin
- @stat = ::File.stat(self[:path])
+ @stat = File.stat(self[:path])
rescue => error
Puppet.debug "Failed to stat %s: %s" %
[self[:path],error]
@@ -404,7 +404,7 @@ module Puppet
Dir.foreach(self[:path]) { |file|
next if file =~ /^\.\.?/ # skip . and ..
- arghash[:path] = ::File.join(self[:path],file)
+ arghash[:path] = File.join(self[:path],file)
child = nil
# if the file already exists...
@@ -421,19 +421,19 @@ module Puppet
end
end
end
- end # Puppet::Type::File
+ end # Puppet::Type::PFile
end # Puppet::Type
- class FileSource
+ class PFileSource
attr_accessor :name
@sources = Hash.new(nil)
- def FileSource.[]=(name,sub)
+ def PFileSource.[]=(name,sub)
@sources[name] = sub
end
- def FileSource.[](name)
+ def PFileSource.[](name)
return @sources[name]
end
@@ -444,7 +444,7 @@ module Puppet
yield self
end
- FileSource[name] = self
+ PFileSource[name] = self
end
end
end
diff --git a/lib/puppet/type/pprocess.rb b/lib/puppet/type/pprocess.rb
index 5ee12a9e2..1b14fa07d 100644
--- a/lib/puppet/type/pprocess.rb
+++ b/lib/puppet/type/pprocess.rb
@@ -5,7 +5,7 @@
module Puppet
class State
- class ProcessRunning < State
+ class PProcessRunning < State
def retrieve
running = 0
regex = Regexp.new(@params[:pattern])
@@ -44,8 +44,8 @@ module Puppet
uid = Etc.getpwnam(@params[:user]).uid
end
Kernel.fork {
- Process.uid = uid
- Process.euid = uid
+ PProcess.uid = uid
+ PProcess.euid = uid
string = @params[:binary] + (@params[:arguments] || "")
Puppet::Message.new(
:level => :notice,
@@ -58,7 +58,7 @@ module Puppet
end
end
class Type
- class BProcess < Type
+ class PProcess < Type
attr_reader :stat, :path
@parameters = [:start, :stop, :user, :pattern, :binary, :arguments]
@name = :process
@@ -77,7 +77,7 @@ module Puppet
:pattern => :pattern
})
- end # Puppet::Type::BProcess
+ end # Puppet::Type::PProcess
end # Puppet::Type
end
diff --git a/lib/puppet/type/symlink.rb b/lib/puppet/type/symlink.rb
index b33e81dba..811f9aa2b 100644
--- a/lib/puppet/type/symlink.rb
+++ b/lib/puppet/type/symlink.rb
@@ -4,7 +4,7 @@
require 'etc'
require 'puppet/type/state'
-require 'puppet/type/file'
+require 'puppet/type/pfile'
module Puppet
# okay, how do we deal with parameters that don't have operations
@@ -91,9 +91,9 @@ module Puppet
attr_reader :stat, :path, :params
# class instance variable
@states = [
- Puppet::State::FileUID,
- Puppet::State::FileGroup,
- Puppet::State::FileMode,
+ Puppet::State::PFileUID,
+ Puppet::State::PFileGroup,
+ Puppet::State::PFileMode,
Puppet::State::SymlinkTarget
]
diff --git a/test/other/tc_metrics.rb b/test/other/tc_metrics.rb
index 1dd73a305..f111ea792 100644
--- a/test/other/tc_metrics.rb
+++ b/test/other/tc_metrics.rb
@@ -19,7 +19,7 @@ class TestMetric < Test::Unit::TestCase
eventmax = 10
maxdiff = 10
- types = [Puppet::Type::File, Puppet::Type::Package, Puppet::Type::Service]
+ types = [Puppet::Type::PFile, Puppet::Type::Package, Puppet::Type::Service]
data = [:total, :managed, :outofsync, :changed, :totalchanges]
events = [:file_changed, :package_installed, :service_started]
diff --git a/test/other/tc_state.rb b/test/other/tc_state.rb
index 5ab5a7cb3..3720f6286 100644
--- a/test/other/tc_state.rb
+++ b/test/other/tc_state.rb
@@ -41,7 +41,7 @@ class TestStorage < Test::Unit::TestCase
file = nil
state = nil
assert_nothing_raised {
- file = Puppet::Type::File.new(
+ file = Puppet::Type::PFile.new(
:path => "/etc/passwd"
)
}
diff --git a/test/other/tc_transactions.rb b/test/other/tc_transactions.rb
index ac2cd8578..03c5134e2 100644
--- a/test/other/tc_transactions.rb
+++ b/test/other/tc_transactions.rb
@@ -31,13 +31,13 @@ class TestTransactions < Test::Unit::TestCase
def newfile
assert_nothing_raised() {
cfile = File.join($puppetbase,"examples/root/etc/configfile")
- unless Puppet::Type::File.has_key?(cfile)
- Puppet::Type::File.new(
+ unless Puppet::Type::PFile.has_key?(cfile)
+ Puppet::Type::PFile.new(
:path => cfile,
:check => [:mode, :owner, :group]
)
end
- return Puppet::Type::File[cfile]
+ return Puppet::Type::PFile[cfile]
}
end
diff --git a/test/types/tc_basic.rb b/test/types/tc_basic.rb
index a62bc4aba..cd567855c 100644
--- a/test/types/tc_basic.rb
+++ b/test/types/tc_basic.rb
@@ -27,7 +27,7 @@ class TestBasic < Test::Unit::TestCase
assert_nothing_raised() {
@filepath = "/tmp/testfile"
system("rm -f %s" % @filepath)
- @configfile = Puppet::Type::File.new(
+ @configfile = Puppet::Type::PFile.new(
:path => @filepath,
:create => true,
:checksum => "md5"
diff --git a/test/types/tc_file.rb b/test/types/tc_file.rb
index e40060c01..00f942a33 100644
--- a/test/types/tc_file.rb
+++ b/test/types/tc_file.rb
@@ -19,14 +19,14 @@ class TestFile < Test::Unit::TestCase
Puppet[:loglevel] = :debug if __FILE__ == $0
Puppet[:statefile] = "/var/tmp/puppetstate"
assert_nothing_raised() {
- @file = Puppet::Type::File.new(
+ @file = Puppet::Type::PFile.new(
:path => @path
)
}
end
def teardown
- Puppet::Type::File.clear
+ Puppet::Type::PFile.clear
system("rm -f %s" % Puppet[:statefile])
end
@@ -84,7 +84,7 @@ class TestFile < Test::Unit::TestCase
%w{a b c d}.collect { |name| "/tmp/createst%s" % name }.each { |path|
file =nil
assert_nothing_raised() {
- file = Puppet::Type::File.new(
+ file = Puppet::Type::PFile.new(
:path => path,
:create => true
)
@@ -142,7 +142,7 @@ class TestFile < Test::Unit::TestCase
}
# okay, we now know that we have a file...
assert_nothing_raised() {
- file = Puppet::Type::File.new(
+ file = Puppet::Type::PFile.new(
:path => path,
:checksum => type
)
@@ -177,7 +177,7 @@ class TestFile < Test::Unit::TestCase
events.include?(:file_modified)
)
assert_nothing_raised() {
- Puppet::Type::File.clear
+ Puppet::Type::PFile.clear
}
assert_nothing_raised() {
system("rm -f %s" % path)
diff --git a/test/types/tc_query.rb b/test/types/tc_query.rb
index 9bb2dd72e..242e160ff 100644
--- a/test/types/tc_query.rb
+++ b/test/types/tc_query.rb
@@ -26,13 +26,13 @@ class TestQuery < Test::Unit::TestCase
def file
assert_nothing_raised() {
cfile = File.join($puppetbase,"examples/root/etc/configfile")
- unless Puppet::Type::File.has_key?(cfile)
- Puppet::Type::File.new(
+ unless Puppet::Type::PFile.has_key?(cfile)
+ Puppet::Type::PFile.new(
:path => cfile,
:check => [:mode, :owner]
)
end
- @configfile = Puppet::Type::File[cfile]
+ @configfile = Puppet::Type::PFile[cfile]
}
return @configfile
end