summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-02-15 21:56:54 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-02-15 21:56:54 +0000
commit037b7acab071adc727fbed8cfc3cea1c0399c2e2 (patch)
treea659e17c133ddb93664a67dc16bad9d257bf66ce /lib/puppet
parent6fe01cedeb2fe00df62bf63d7f7375d18d0663ca (diff)
downloadpuppet-037b7acab071adc727fbed8cfc3cea1c0399c2e2.tar.gz
puppet-037b7acab071adc727fbed8cfc3cea1c0399c2e2.tar.xz
puppet-037b7acab071adc727fbed8cfc3cea1c0399c2e2.zip
Changed the parsedtype definition of exists(), and fixed a few smaller bugs. Last code commit before 0.13.2
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@915 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/parser/interpreter.rb6
-rwxr-xr-xlib/puppet/type/parsedtype.rb13
-rwxr-xr-xlib/puppet/type/parsedtype/port.rb3
-rw-r--r--lib/puppet/type/pfile.rb2
4 files changed, 11 insertions, 13 deletions
diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb
index ce6a9935c..1ad039f06 100644
--- a/lib/puppet/parser/interpreter.rb
+++ b/lib/puppet/parser/interpreter.rb
@@ -83,7 +83,11 @@ module Puppet
# Connect to the LDAP Server
def setup_ldap
- require 'ldap'
+ begin
+ require 'ldap'
+ rescue LoadError
+ @ldap = nil
+ end
begin
@ldap = LDAP::Conn.new(Puppet[:ldapserver], Puppet[:ldapport])
@ldap.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)
diff --git a/lib/puppet/type/parsedtype.rb b/lib/puppet/type/parsedtype.rb
index 0429bcdd1..358c489ab 100755
--- a/lib/puppet/type/parsedtype.rb
+++ b/lib/puppet/type/parsedtype.rb
@@ -280,18 +280,9 @@ module Puppet
self.store
end
- # We just find any state and check whether it's marked absent
+ # hash2obj marks the 'ensure' state as present
def exists?
- name, state = @states.find { |name, state|
- state.is_a?(Puppet::State::ParsedParam)
- }
-
- # Unless we've retrieved, we don't know if we exist
- if ! state.is or state.is == :absent
- return false
- else
- return true
- end
+ @states.include?(:ensure) and @states[:ensure].is == :present
end
def destroy
diff --git a/lib/puppet/type/parsedtype/port.rb b/lib/puppet/type/parsedtype/port.rb
index 369d2aea3..feaa3afed 100755
--- a/lib/puppet/type/parsedtype/port.rb
+++ b/lib/puppet/type/parsedtype/port.rb
@@ -54,6 +54,7 @@ module Puppet
newstate(:description) do
desc "The port description."
+ isoptional
end
newstate(:alias) do
@@ -62,6 +63,8 @@ module Puppet
one of the metaparams; using this state to set aliases will make
those aliases available in your Puppet scripts and also on disk."
+ isoptional
+
# We have to override the feeding mechanism; it might be nil or
# white-space separated
def is=(value)
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb
index 6f064ee2a..69f636bec 100644
--- a/lib/puppet/type/pfile.rb
+++ b/lib/puppet/type/pfile.rb
@@ -98,7 +98,7 @@ module Puppet
cur = []
# Skip the nil in the beginning and don't add ourselves as a prereq
# either.
- self.name.split(File::SEPARATOR)[1..-2].collect { |dir|
+ self[:path].split(File::SEPARATOR)[1..-2].collect { |dir|
cur << dir
"/" + cur.join(File::SEPARATOR)
}