summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-07-19 00:29:09 +0000
committerLuke Kanies <luke@madstop.com>2005-07-19 00:29:09 +0000
commit311218be95ea0c217dd90003e541cc299ea841b8 (patch)
tree700018c47bfd4b7029a43c81312b5e9f343d8ac7
parent6f4f8212955853ef60332d02a62a6a2596dc71f5 (diff)
downloadpuppet-311218be95ea0c217dd90003e541cc299ea841b8.tar.gz
puppet-311218be95ea0c217dd90003e541cc299ea841b8.tar.xz
puppet-311218be95ea0c217dd90003e541cc299ea841b8.zip
removing, since pfile now has link functionality
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@419 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--lib/puppet/type/symlink.rb109
1 files changed, 0 insertions, 109 deletions
diff --git a/lib/puppet/type/symlink.rb b/lib/puppet/type/symlink.rb
deleted file mode 100644
index dca2da9a5..000000000
--- a/lib/puppet/type/symlink.rb
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# $Id$
-
-require 'etc'
-require 'puppet/type/state'
-require 'puppet/type/pfile'
-
-module Puppet
- # okay, how do we deal with parameters that don't have operations
- # associated with them?
- class State
- class SymlinkTarget < Puppet::State
- require 'etc'
- attr_accessor :file
-
- @name = :target
-
- def create
- begin
- debug("Creating symlink '%s' to '%s'" %
- [self.parent[:path],self.should])
- unless File.symlink(self.should,self.parent[:path])
- raise TypeError.new("Could not create symlink '%s'" %
- self.parent[:path])
- end
- rescue => detail
- raise TypeError.new("Cannot create symlink '%s': %s" %
- [self.parent[:path],detail])
- end
- end
-
- def remove
- if FileTest.symlink?(self.parent[:path])
- debug("Removing symlink '%s'" % self.parent[:path])
- begin
- File.unlink(self.parent[:path])
- rescue
- raise TypeError.new("Failed to remove symlink '%s'" %
- self.parent[:path])
- end
- elsif FileTest.exists?(self.parent[:path])
- raise TypeError.new("Cannot remove normal file '%s'" %
- self.parent[:path])
- else
- debug("Symlink '%s' does not exist" %
- self.parent[:path])
- end
- end
-
- def retrieve
- stat = nil
-
- if FileTest.symlink?(self.parent[:path])
- self.is = File.readlink(self.parent[:path])
- debug("link value is '%s'" % self.is)
- return
- else
- self.is = nil
- return
- end
- end
-
- # this is somewhat complicated, because it could exist and be
- # a file
- def sync
- if self.should.nil?
- self.remove()
- else # it should exist and be a symlink
- if FileTest.symlink?(self.parent[:path])
- path = File.readlink(self.parent[:path])
- if path != self.should
- self.remove()
- self.create()
- end
- elsif FileTest.exists?(self.parent[:path])
- raise TypeError.new("Cannot replace normal file '%s'" %
- self.parent[:path])
- else
- self.create()
- end
- end
-
- #self.parent.newevent(:event => :inode_changed)
- end
- end
- end
-
- class Type
- class Symlink < Type
- attr_reader :stat, :path, :params
- # class instance variable
- @states = [
- Puppet::State::PFileUID,
- Puppet::State::PFileGroup,
- Puppet::State::PFileMode,
- Puppet::State::SymlinkTarget
- ]
-
- @parameters = [
- :path
- ]
-
- @name = :symlink
- @namevar = :path
- end # Puppet::Type::Symlink
- end # Puppet::Type
-
-end