summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG4
-rwxr-xr-xbin/puppetca6
-rwxr-xr-xconf/gentoo/init.d/puppetmaster3
-rwxr-xr-xext/puppetlast40
-rw-r--r--lib/puppet/network/http_pool.rb5
-rw-r--r--lib/puppet/network/xmlrpc/client.rb2
-rwxr-xr-xlib/puppet/provider/package/freebsd.rb19
-rwxr-xr-xlib/puppet/provider/package/ports.rb7
-rw-r--r--lib/puppet/rails/database/schema.rb9
-rw-r--r--lib/puppet/rails/resource.rb1
-rwxr-xr-xspec/unit/network/http_pool.rb16
11 files changed, 93 insertions, 19 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 224762771..faac271d3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+ Added support for the --all option to puppetca --clean. If
+ puppetca --clean --all is issued then all client certificates
+ are removed.
+
Resources now return the 'should' value for properties from
the [] accessor method (they previously threw an exception when
this method was used with properties). This shouldn't have any
diff --git a/bin/puppetca b/bin/puppetca
index fca623ebe..75988432f 100755
--- a/bin/puppetca
+++ b/bin/puppetca
@@ -32,14 +32,16 @@
# '--genconfig'.
#
# all::
-# Operate on all outstanding requests. Only makes sense with '--sign',
-# or '--list'.
+# Operate on all items. Currently only makes sense with '--sign',
+# '--clean', or '--list'.
#
# clean::
# Remove all files related to a host from puppetca's storage. This is
# useful when rebuilding hosts, since new certificate signing requests
# will only be honored if puppetca does not have a copy of a signed
# certificate for that host. The certificate of the host remains valid.
+# If '--all' is specified then all host certificates, both signed and
+# unsigned, will be removed.
#
# debug::
# Enable full debugging.
diff --git a/conf/gentoo/init.d/puppetmaster b/conf/gentoo/init.d/puppetmaster
index 67ada5c41..fcf71add4 100755
--- a/conf/gentoo/init.d/puppetmaster
+++ b/conf/gentoo/init.d/puppetmaster
@@ -34,7 +34,8 @@ start() {
[[ -n "${PUPPETMASTER_EXTRA_OPTS}" ]] && options="${options} ${PUPPETMASTER_EXTRA_OPTS}"
ebegin "Starting puppetmaster"
- start-stop-daemon --start --quiet --exec /usr/bin/puppetmasterd \
+ start-stop-daemon --start --quiet \
+ --pidfile ${PUPPETMASTER_PID_DIR}/puppetmasterd.pid --exec /usr/bin/puppetmasterd \
-- ${options}
eend $? "Failed to start puppetmaster"
}
diff --git a/ext/puppetlast b/ext/puppetlast
new file mode 100755
index 000000000..e8c2ea1a7
--- /dev/null
+++ b/ext/puppetlast
@@ -0,0 +1,40 @@
+#!/usr/bin/env ruby
+#
+# Script to print out when puppet ran successfully last
+# AJ Christensen <aj@junglist.gen.nz>
+#
+
+require 'puppet'
+require 'puppet/defaults'
+require 'yaml'
+
+Puppet[:config] = "/etc/puppet/puppet.conf"
+Puppet.parse_config
+
+print "puppetlast\n"
+
+nodes = {}
+
+yfdir = Puppet.settings.value(:vardir) + "/yaml/facts"
+
+if yfdir
+ begin
+ Dir.chdir(yfdir) do
+ Dir.glob("*.yaml").each do |yaml|
+ data = YAML.load_file(yaml)
+ t = Time.now
+ age = t - data.version
+ nodes[data.name] = age.to_i
+ end
+ end
+
+ nodes.sort.each do |node,age|
+ minutes = age / 60 + 0.5
+ print minutes.floor.to_s + ' minutes ago: ' + node + "\n"
+ end
+
+ rescue
+ print 'error: ' + $! + "\n"
+ end
+
+end
diff --git a/lib/puppet/network/http_pool.rb b/lib/puppet/network/http_pool.rb
index 9d37f2eeb..1227f78dc 100644
--- a/lib/puppet/network/http_pool.rb
+++ b/lib/puppet/network/http_pool.rb
@@ -88,8 +88,9 @@ module Puppet::Network::HttpPool
class << http; attr_accessor :ca_file; end
http.use_ssl = true
- http.read_timeout = 120
- http.open_timeout = 120
+ # Use configured timeout (#1176)
+ http.read_timeout = Puppet[:configtimeout]
+ http.open_timeout = Puppet[:configtimeout]
# JJM Configurable fix for #896.
if Puppet[:http_enable_post_connection_check]
http.enable_post_connection_check = true
diff --git a/lib/puppet/network/xmlrpc/client.rb b/lib/puppet/network/xmlrpc/client.rb
index 357a766a1..e0fb5a0ab 100644
--- a/lib/puppet/network/xmlrpc/client.rb
+++ b/lib/puppet/network/xmlrpc/client.rb
@@ -123,7 +123,7 @@ module Puppet::Network
nil, # user
nil, # password
true, # use_ssl
- 120 # a two minute timeout, instead of 30 seconds
+ Puppet[:configtimeout] # use configured timeout (#1176)
)
@http = Puppet::Network::HttpPool.http_instance(@host, @port)
end
diff --git a/lib/puppet/provider/package/freebsd.rb b/lib/puppet/provider/package/freebsd.rb
index f98f3064e..18df015fd 100755
--- a/lib/puppet/provider/package/freebsd.rb
+++ b/lib/puppet/provider/package/freebsd.rb
@@ -18,11 +18,22 @@ Puppet::Type.type(:package).provide :freebsd, :parent => :openbsd do
def install
should = @resource.should(:ensure)
- if @resource[:source]
- return super
+ if @resource[:source] =~ /\/$/
+ if @resource[:source] =~ /^(ftp|https?):/
+ withenv :PACKAGESITE => @resource[:source] do
+ pkgadd "-r", @resource[:name]
+ end
+ else
+ withenv :PKG_PATH => @resource[:source] do
+ pkgadd @resource[:name]
+ end
+ end
+ else
+ if @resource[:source]
+ Puppet.warning "source is defined but does not have trailing slash, ignoring %s" % @resource[:source]
+ end
+ pkgadd "-r", @resource[:name]
end
-
- pkgadd "-r", @resource[:name]
end
def query
diff --git a/lib/puppet/provider/package/ports.rb b/lib/puppet/provider/package/ports.rb
index 1cff30039..99e26ef23 100755
--- a/lib/puppet/provider/package/ports.rb
+++ b/lib/puppet/provider/package/ports.rb
@@ -72,8 +72,13 @@ Puppet::Type.type(:package).provide :ports, :parent => :freebsd, :source => :fre
end
def query
+ # support portorigin_glob such as "mail/postfix"
+ name = self.name
+ if name =~ /\//
+ name = self.name.split(/\//).slice(1)
+ end
self.class.instances.each do |instance|
- if instance.name == self.name
+ if instance.name == name
return instance.properties
end
end
diff --git a/lib/puppet/rails/database/schema.rb b/lib/puppet/rails/database/schema.rb
index 5365ce2a4..d11d91aa5 100644
--- a/lib/puppet/rails/database/schema.rb
+++ b/lib/puppet/rails/database/schema.rb
@@ -14,6 +14,7 @@ class Puppet::Rails::Schema
t.column :exported, :boolean
t.column :line, :integer
t.column :updated_at, :datetime
+ t.column :created_at, :datetime
end
add_index :resources, :id, :integer => true
add_index :resources, :host_id, :integer => true
@@ -31,6 +32,7 @@ class Puppet::Rails::Schema
t.column :filename, :string
t.column :path, :string
t.column :updated_at, :datetime
+ t.column :created_at, :datetime
end
add_index :source_files, :id, :integer => true
add_index :source_files, :filename
@@ -39,6 +41,7 @@ class Puppet::Rails::Schema
t.column :resource_id, :integer
t.column :puppet_tag_id, :integer
t.column :updated_at, :datetime
+ t.column :created_at, :datetime
end
add_index :resource_tags, :id, :integer => true
add_index :resource_tags, :resource_id, :integer => true
@@ -47,6 +50,7 @@ class Puppet::Rails::Schema
create_table :puppet_tags do |t|
t.column :name, :string
t.column :updated_at, :datetime
+ t.column :created_at, :datetime
end
add_index :puppet_tags, :id, :integer => true
@@ -59,6 +63,7 @@ class Puppet::Rails::Schema
#Use updated_at to automatically add timestamp on save.
t.column :updated_at, :datetime
t.column :source_file_id, :integer
+ t.column :created_at, :datetime
end
add_index :hosts, :id, :integer => true
add_index :hosts, :source_file_id, :integer => true
@@ -67,6 +72,7 @@ class Puppet::Rails::Schema
create_table :fact_names do |t|
t.column :name, :string, :null => false
t.column :updated_at, :datetime
+ t.column :created_at, :datetime
end
add_index :fact_names, :id, :integer => true
add_index :fact_names, :name
@@ -76,6 +82,7 @@ class Puppet::Rails::Schema
t.column :fact_name_id, :integer, :null => false
t.column :host_id, :integer, :null => false
t.column :updated_at, :datetime
+ t.column :created_at, :datetime
end
add_index :fact_values, :id, :integer => true
add_index :fact_values, :fact_name_id, :integer => true
@@ -87,6 +94,7 @@ class Puppet::Rails::Schema
t.column :line, :integer
t.column :resource_id, :integer
t.column :updated_at, :datetime
+ t.column :created_at, :datetime
end
add_index :param_values, :id, :integer => true
add_index :param_values, :param_name_id, :integer => true
@@ -95,6 +103,7 @@ class Puppet::Rails::Schema
create_table :param_names do |t|
t.column :name, :string, :null => false
t.column :updated_at, :datetime
+ t.column :created_at, :datetime
end
add_index :param_names, :id, :integer => true
add_index :param_names, :name
diff --git a/lib/puppet/rails/resource.rb b/lib/puppet/rails/resource.rb
index 785c63419..0053dc28d 100644
--- a/lib/puppet/rails/resource.rb
+++ b/lib/puppet/rails/resource.rb
@@ -98,6 +98,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base
hash.delete("host_id")
hash.delete("updated_at")
hash.delete("source_file_id")
+ hash.delete("created_at")
hash.delete("id")
hash.each do |p, v|
hash.delete(p) if v.nil?
diff --git a/spec/unit/network/http_pool.rb b/spec/unit/network/http_pool.rb
index 1fbc17471..3c52c8613 100755
--- a/spec/unit/network/http_pool.rb
+++ b/spec/unit/network/http_pool.rb
@@ -148,7 +148,7 @@ describe Puppet::Network::HttpPool, " when adding certificate information to htt
end
it "should create the http instance with the proxy host and port set if the http_proxy is not set to 'none'" do
- stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :http_enable_post_connection_check => true
+ stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120, :http_enable_post_connection_check => true
Puppet::Network::HttpPool.http_instance("me", 54321).open_timeout.should == 120
end
@@ -158,19 +158,19 @@ describe Puppet::Network::HttpPool, " when adding certificate information to htt
end
it "should cache http instances" do
- stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :http_enable_post_connection_check => true
+ stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120, :http_enable_post_connection_check => true
old = Puppet::Network::HttpPool.http_instance("me", 54321)
Puppet::Network::HttpPool.http_instance("me", 54321).should equal(old)
end
it "should have a mechanism for getting a new http instance instead of the cached instance" do
- stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :http_enable_post_connection_check => true
+ stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120, :http_enable_post_connection_check => true
old = Puppet::Network::HttpPool.http_instance("me", 54321)
Puppet::Network::HttpPool.http_instance("me", 54321, true).should_not equal(old)
end
it "should close existing, open connections when requesting a new connection" do
- stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :http_enable_post_connection_check => true
+ stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120, :http_enable_post_connection_check => true
old = Puppet::Network::HttpPool.http_instance("me", 54321)
old.expects(:started?).returns(true)
old.expects(:finish)
@@ -178,7 +178,7 @@ describe Puppet::Network::HttpPool, " when adding certificate information to htt
end
it "should have a mechanism for clearing the http cache" do
- stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :http_enable_post_connection_check => true
+ stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120, :http_enable_post_connection_check => true
old = Puppet::Network::HttpPool.http_instance("me", 54321)
Puppet::Network::HttpPool.http_instance("me", 54321).should equal(old)
old = Puppet::Network::HttpPool.http_instance("me", 54321)
@@ -187,7 +187,7 @@ describe Puppet::Network::HttpPool, " when adding certificate information to htt
end
it "should close open http connections when clearing the cache" do
- stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :http_enable_post_connection_check => true
+ stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120, :http_enable_post_connection_check => true
one = Puppet::Network::HttpPool.http_instance("me", 54321)
one.expects(:started?).returns(true)
one.expects(:finish).returns(true)
@@ -195,7 +195,7 @@ describe Puppet::Network::HttpPool, " when adding certificate information to htt
end
it "should not close unopened http connections when clearing the cache" do
- stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :http_enable_post_connection_check => true
+ stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120, :http_enable_post_connection_check => true
one = Puppet::Network::HttpPool.http_instance("me", 54321)
one.expects(:started?).returns(false)
one.expects(:finish).never
@@ -209,7 +209,7 @@ describe Puppet::Network::HttpPool, " when adding certificate information to htt
end
it "should not cache http instances" do
- stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :http_enable_post_connection_check => true
+ stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120, :http_enable_post_connection_check => true
old = Puppet::Network::HttpPool.http_instance("me", 54321)
Puppet::Network::HttpPool.http_instance("me", 54321).should_not equal(old)
end