puppet 2.6.6 → 2.6.7
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +107 -1
- data/README.queueing +1 -1
- data/Rakefile +1 -1
- data/conf/solaris/smf/svc-puppetd +0 -2
- data/conf/solaris/smf/svc-puppetmasterd +0 -2
- data/examples/etc/init.d/sleeper +0 -2
- data/examples/modules/sample-module/README.txt +2 -2
- data/ext/puppetstoredconfigclean.rb +1 -1
- data/install.rb +20 -25
- data/lib/puppet.rb +1 -1
- data/lib/puppet/application/agent.rb +2 -2
- data/lib/puppet/application/apply.rb +2 -2
- data/lib/puppet/application/cert.rb +27 -11
- data/lib/puppet/application/filebucket.rb +1 -1
- data/lib/puppet/application/inspect.rb +1 -1
- data/lib/puppet/application/kick.rb +2 -2
- data/lib/puppet/application/master.rb +1 -1
- data/lib/puppet/application/queue.rb +2 -2
- data/lib/puppet/configurer/downloader.rb +1 -0
- data/lib/puppet/configurer/plugin_handler.rb +8 -1
- data/lib/puppet/daemon.rb +1 -1
- data/lib/puppet/defaults.rb +18 -2
- data/lib/puppet/external/nagios.rb +0 -2
- data/lib/puppet/external/nagios/base.rb +0 -2
- data/lib/puppet/indirector/facts/inventory_active_record.rb +97 -0
- data/lib/puppet/indirector/facts/rest.rb +2 -0
- data/lib/puppet/indirector/facts/yaml.rb +75 -0
- data/lib/puppet/indirector/indirection.rb +1 -0
- data/lib/puppet/module.rb +1 -1
- data/lib/puppet/network/http/api/v1.rb +3 -4
- data/lib/puppet/network/http/compression.rb +4 -1
- data/lib/puppet/network/http/handler.rb +1 -1
- data/lib/puppet/network/rest_authconfig.rb +1 -1
- data/lib/puppet/node/facts.rb +29 -0
- data/lib/puppet/parser/ast/collection.rb +5 -4
- data/lib/puppet/parser/ast/leaf.rb +1 -1
- data/lib/puppet/parser/functions/regsubst.rb +7 -14
- data/lib/puppet/parser/functions/split.rb +7 -7
- data/lib/puppet/parser/grammar.ra +2 -4
- data/lib/puppet/parser/lexer.rb +4 -1
- data/lib/puppet/parser/parser.rb +2062 -1976
- data/lib/puppet/parser/parser_support.rb +3 -3
- data/lib/puppet/provider/computer/computer.rb +1 -3
- data/lib/puppet/provider/mount.rb +12 -16
- data/lib/puppet/provider/mount/parsed.rb +67 -8
- data/lib/puppet/provider/parsedfile.rb +3 -1
- data/lib/puppet/provider/service/daemontools.rb +6 -6
- data/lib/puppet/provider/service/gentoo.rb +0 -2
- data/lib/puppet/provider/service/launchd.rb +11 -8
- data/lib/puppet/provider/service/runit.rb +4 -4
- data/lib/puppet/provider/user/useradd.rb +6 -1
- data/lib/puppet/rails/database/004_add_inventory_service_tables.rb +36 -0
- data/lib/puppet/rails/database/schema.rb +17 -0
- data/lib/puppet/rails/fact_name.rb +0 -2
- data/lib/puppet/rails/fact_value.rb +0 -2
- data/lib/puppet/rails/inventory_fact.rb +5 -0
- data/lib/puppet/rails/inventory_node.rb +25 -0
- data/lib/puppet/reference/configuration.rb +1 -1
- data/lib/puppet/reference/metaparameter.rb +1 -1
- data/lib/puppet/reports/store.rb +4 -1
- data/lib/puppet/resource.rb +39 -25
- data/lib/puppet/type.rb +5 -5
- data/lib/puppet/type/augeas.rb +4 -4
- data/lib/puppet/type/computer.rb +5 -1
- data/lib/puppet/type/exec.rb +3 -1
- data/lib/puppet/type/file.rb +3 -1
- data/lib/puppet/type/file/content.rb +13 -15
- data/lib/puppet/type/file/ensure.rb +11 -17
- data/lib/puppet/type/file/selcontext.rb +16 -0
- data/lib/puppet/type/file/target.rb +14 -1
- data/lib/puppet/type/k5login.rb +0 -2
- data/lib/puppet/type/macauthorization.rb +4 -1
- data/lib/puppet/type/mcx.rb +4 -1
- data/lib/puppet/type/mount.rb +37 -21
- data/lib/puppet/type/package.rb +5 -1
- data/lib/puppet/type/schedule.rb +20 -20
- data/lib/puppet/type/selmodule.rb +3 -1
- data/lib/puppet/type/ssh_authorized_key.rb +5 -1
- data/lib/puppet/type/user.rb +14 -1
- data/lib/puppet/type/zfs.rb +3 -1
- data/lib/puppet/type/zone.rb +3 -1
- data/lib/puppet/type/zpool.rb +7 -5
- data/lib/puppet/util.rb +5 -0
- data/lib/puppet/util/command_line.rb +1 -1
- data/lib/puppet/util/execution.rb +4 -5
- data/lib/puppet/util/execution_stub.rb +26 -0
- data/lib/puppet/util/monkey_patches.rb +21 -0
- data/lib/puppet/util/rdoc/code_objects.rb +39 -0
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +18 -0
- data/lib/puppet/util/rdoc/parser.rb +5 -3
- data/lib/puppet/util/settings.rb +1 -1
- data/spec/integration/parser/parser_spec.rb +7 -0
- data/spec/integration/provider/mount_spec.rb +151 -0
- data/spec/integration/type/file_spec.rb +32 -29
- data/spec/spec_helper.rb +2 -0
- data/spec/unit/application/agent_spec.rb +3 -7
- data/spec/unit/application/apply_spec.rb +17 -2
- data/spec/unit/application/cert_spec.rb +54 -14
- data/spec/unit/application/filebucket_spec.rb +1 -1
- data/spec/unit/application/queue_spec.rb +1 -5
- data/spec/unit/configurer/downloader_spec.rb +22 -10
- data/spec/unit/daemon_spec.rb +1 -5
- data/spec/unit/indirector/facts/inventory_active_record_spec.rb +163 -0
- data/spec/unit/indirector/facts/yaml_spec.rb +216 -2
- data/spec/unit/indirector/queue_spec.rb +3 -0
- data/spec/unit/module_spec.rb +2 -2
- data/spec/unit/network/handler/fileserver_spec.rb +1 -1
- data/spec/unit/network/http/api/v1_spec.rb +28 -0
- data/spec/unit/network/http/compression_spec.rb +1 -1
- data/spec/unit/network/http/handler_spec.rb +7 -4
- data/spec/unit/node/facts_spec.rb +24 -0
- data/spec/unit/parser/ast/collection_spec.rb +16 -12
- data/spec/unit/parser/lexer_spec.rb +16 -0
- data/spec/unit/parser/parser_spec.rb +35 -2
- data/spec/unit/provider/mount/parsed_spec.rb +199 -114
- data/spec/unit/provider/mount_spec.rb +54 -53
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -0
- data/spec/unit/provider/user/user_role_add_spec.rb +1 -0
- data/spec/unit/provider/user/useradd_spec.rb +43 -3
- data/spec/unit/reports/store_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +39 -13
- data/spec/unit/type/file/content_spec.rb +38 -137
- data/spec/unit/type/file/selinux_spec.rb +5 -0
- data/spec/unit/type/mount_spec.rb +167 -122
- data/spec/unit/type/user_spec.rb +4 -0
- data/spec/unit/type_spec.rb +12 -1
- data/spec/unit/util/execution_spec.rb +49 -0
- data/spec/unit/util/execution_stub_spec.rb +35 -0
- data/spec/unit/util/rdoc/parser_spec.rb +15 -3
- data/spec/unit/util/settings_spec.rb +11 -2
- data/tasks/rake/git_workflow.rake +1 -1
- data/test/Rakefile +0 -2
- data/test/data/providers/mount/parsed/aix.mount +7 -0
- data/test/data/providers/mount/parsed/darwin.mount +6 -0
- data/test/data/providers/mount/parsed/hpux.mount +17 -0
- data/test/data/providers/mount/parsed/linux.mount +5 -0
- data/test/data/providers/mount/parsed/solaris.mount +6 -0
- data/test/data/types/mount/linux.fstab +1 -0
- data/test/data/types/mount/solaris.fstab +1 -0
- metadata +18 -4
@@ -135,19 +135,19 @@ class Puppet::Parser::Parser
|
|
135
135
|
|
136
136
|
# Create a new class, or merge with an existing class.
|
137
137
|
def newclass(name, options = {})
|
138
|
-
known_resource_types.add Puppet::Resource::Type.new(:hostclass, name, ast_context(true).merge(options))
|
138
|
+
known_resource_types.add Puppet::Resource::Type.new(:hostclass, name, ast_context(true, options[:line]).merge(options))
|
139
139
|
end
|
140
140
|
|
141
141
|
# Create a new definition.
|
142
142
|
def newdefine(name, options = {})
|
143
|
-
known_resource_types.add Puppet::Resource::Type.new(:definition, name, ast_context(true).merge(options))
|
143
|
+
known_resource_types.add Puppet::Resource::Type.new(:definition, name, ast_context(true, options[:line]).merge(options))
|
144
144
|
end
|
145
145
|
|
146
146
|
# Create a new node. Nodes are special, because they're stored in a global
|
147
147
|
# table, not according to namespaces.
|
148
148
|
def newnode(names, options = {})
|
149
149
|
names = [names] unless names.instance_of?(Array)
|
150
|
-
context = ast_context(true)
|
150
|
+
context = ast_context(true, options[:line])
|
151
151
|
names.collect do |name|
|
152
152
|
known_resource_types.add(Puppet::Resource::Type.new(:node, name, context.merge(options)))
|
153
153
|
end
|
@@ -10,9 +10,7 @@ Puppet::Type.type(:computer).provide :directoryservice, :parent => Puppet::Provi
|
|
10
10
|
domain, not in remote directories.
|
11
11
|
|
12
12
|
If you wish to manage /etc/hosts on Mac OS X, then simply use the host
|
13
|
-
type as per other platforms.
|
14
|
-
|
15
|
-
"
|
13
|
+
type as per other platforms."
|
16
14
|
|
17
15
|
confine :operatingsystem => :darwin
|
18
16
|
defaultfor :operatingsystem => :darwin
|
@@ -14,8 +14,11 @@ module Puppet::Provider::Mount
|
|
14
14
|
args << "-o" << self.options if self.options and self.options != :absent
|
15
15
|
args << resource[:name]
|
16
16
|
|
17
|
-
flush if respond_to?(:flush)
|
18
17
|
mountcmd(*args)
|
18
|
+
case get(:ensure)
|
19
|
+
when :absent; set(:ensure => :ghost)
|
20
|
+
when :unmounted; set(:ensure => :mounted)
|
21
|
+
end
|
19
22
|
end
|
20
23
|
|
21
24
|
def remount
|
@@ -30,24 +33,17 @@ module Puppet::Provider::Mount
|
|
30
33
|
|
31
34
|
# This only works when the mount point is synced to the fstab.
|
32
35
|
def unmount
|
33
|
-
umount
|
36
|
+
umount(resource[:name])
|
37
|
+
|
38
|
+
# Update property hash for future queries (e.g. refresh is called)
|
39
|
+
case get(:ensure)
|
40
|
+
when :mounted; set(:ensure => :unmounted)
|
41
|
+
when :ghost; set(:ensure => :absent)
|
42
|
+
end
|
34
43
|
end
|
35
44
|
|
36
45
|
# Is the mount currently mounted?
|
37
46
|
def mounted?
|
38
|
-
|
39
|
-
name = resource[:name]
|
40
|
-
mounts = mountcmd.split("\n").find do |line|
|
41
|
-
case platform
|
42
|
-
when "Darwin"
|
43
|
-
line =~ / on #{name} / or line =~ %r{ on /private/var/automount#{name}}
|
44
|
-
when "Solaris", "HP-UX"
|
45
|
-
line =~ /^#{name} on /
|
46
|
-
when "AIX"
|
47
|
-
line.split(/\s+/)[2] == name
|
48
|
-
else
|
49
|
-
line =~ / on #{name} /
|
50
|
-
end
|
51
|
-
end
|
47
|
+
[:mounted, :ghost].include?(get(:ensure))
|
52
48
|
end
|
53
49
|
end
|
@@ -8,21 +8,17 @@ else
|
|
8
8
|
fstab = "/etc/fstab"
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
:parsed,
|
11
|
+
Puppet::Type.type(:mount).provide(
|
12
|
+
:parsed,
|
14
13
|
:parent => Puppet::Provider::ParsedFile,
|
15
14
|
:default_target => fstab,
|
16
|
-
|
17
15
|
:filetype => :flat
|
18
16
|
) do
|
19
17
|
include Puppet::Provider::Mount
|
20
|
-
#confine :exists => fstab
|
21
18
|
|
22
19
|
commands :mountcmd => "mount", :umount => "umount"
|
23
20
|
|
24
|
-
|
25
|
-
case @platform
|
21
|
+
case Facter["operatingsystem"]
|
26
22
|
when "Solaris"
|
27
23
|
@fields = [:device, :blockdevice, :name, :fstype, :pass, :atboot, :options]
|
28
24
|
else
|
@@ -43,5 +39,68 @@ end
|
|
43
39
|
|
44
40
|
record_line self.name, :fields => @fields, :separator => /\s+/, :joiner => "\t", :optional => optional_fields
|
45
41
|
|
46
|
-
|
42
|
+
# Every entry in fstab is :unmounted until we can prove different
|
43
|
+
def self.prefetch_hook(target_records)
|
44
|
+
target_records.collect do |record|
|
45
|
+
record[:ensure] = :unmounted if record[:record_type] == :parsed
|
46
|
+
record
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.prefetch(resources = nil)
|
51
|
+
# Get providers for all resources the user defined and that match
|
52
|
+
# a record in /etc/fstab.
|
53
|
+
super
|
54
|
+
# We need to do two things now:
|
55
|
+
# - Update ensure from :unmounted to :mounted if the resource is mounted
|
56
|
+
# - Check for mounted devices that are not in fstab and
|
57
|
+
# set ensure to :ghost (if the user wants to add an entry
|
58
|
+
# to fstab we need to know if the device was mounted before)
|
59
|
+
mountinstances.each do |hash|
|
60
|
+
if mount = resources[hash[:name]]
|
61
|
+
case mount.provider.get(:ensure)
|
62
|
+
when :absent # Mount not in fstab
|
63
|
+
mount.provider.set(:ensure => :ghost)
|
64
|
+
when :unmounted # Mount in fstab
|
65
|
+
mount.provider.set(:ensure => :mounted)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
47
70
|
|
71
|
+
def self.mountinstances
|
72
|
+
# XXX: Will not work for mount points that have spaces in path (does fstab support this anyways?)
|
73
|
+
regex = case Facter.value(:operatingsystem)
|
74
|
+
when "Darwin"
|
75
|
+
/ on (?:\/private\/var\/automount)?(\S*)/
|
76
|
+
when "Solaris", "HP-UX"
|
77
|
+
/^(\S*) on /
|
78
|
+
when "AIX"
|
79
|
+
/^(?:\S*\s+\S+\s+)(\S+)/
|
80
|
+
else
|
81
|
+
/ on (\S*)/
|
82
|
+
end
|
83
|
+
instances = []
|
84
|
+
mount_output = mountcmd.split("\n")
|
85
|
+
if mount_output.length >= 2 and mount_output[1] =~ /^[- \t]*$/
|
86
|
+
# On some OSes (e.g. AIX) mount output begins with a header line
|
87
|
+
# followed by a line consisting of dashes and whitespace.
|
88
|
+
# Discard these two lines.
|
89
|
+
mount_output[0..1] = []
|
90
|
+
end
|
91
|
+
mount_output.each do |line|
|
92
|
+
if match = regex.match(line) and name = match.captures.first
|
93
|
+
instances << {:name => name, :mounted => :yes} # Only :name is important here
|
94
|
+
else
|
95
|
+
raise Puppet::Error, "Could not understand line #{line} from mount output"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
instances
|
99
|
+
end
|
100
|
+
|
101
|
+
def flush
|
102
|
+
needs_mount = @property_hash.delete(:needs_mount)
|
103
|
+
super
|
104
|
+
mount if needs_mount
|
105
|
+
end
|
106
|
+
end
|
@@ -334,7 +334,9 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
334
334
|
@property_hash[:target] = @resource.should(:target) || self.class.default_target
|
335
335
|
self.class.modified(@property_hash[:target])
|
336
336
|
end
|
337
|
-
@
|
337
|
+
@resource.class.key_attributes.each do |attr|
|
338
|
+
@property_hash[attr] ||= @resource[attr]
|
339
|
+
end
|
338
340
|
|
339
341
|
self.class.flush(@property_hash)
|
340
342
|
|
@@ -19,10 +19,10 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do
|
|
19
19
|
|
20
20
|
or this can be overriden in the service resource parameters::
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
service { \"myservice\":
|
23
|
+
provider => \"daemontools\",
|
24
|
+
path => \"/path/to/daemons\",
|
25
|
+
}
|
26
26
|
|
27
27
|
This provider supports out of the box:
|
28
28
|
|
@@ -31,10 +31,10 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do
|
|
31
31
|
* restart
|
32
32
|
* status
|
33
33
|
|
34
|
-
If a service has ensure => \"running\"
|
34
|
+
If a service has `ensure => \"running\"`, it will link /path/to/daemon to
|
35
35
|
/path/to/service, which will automatically enable the service.
|
36
36
|
|
37
|
-
If a service has ensure => \"stopped\"
|
37
|
+
If a service has `ensure => \"stopped\"`, it will only down the service, not
|
38
38
|
remove the /path/to/service link.
|
39
39
|
|
40
40
|
"
|
@@ -3,33 +3,36 @@ require 'facter/util/plist'
|
|
3
3
|
Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
4
4
|
desc "launchd service management framework.
|
5
5
|
|
6
|
-
This provider manages launchd
|
7
|
-
Mac OS X
|
8
|
-
other platforms.
|
6
|
+
This provider manages jobs with launchd, which is the default service framework for
|
7
|
+
Mac OS X and is potentially available for use on other platforms.
|
9
8
|
|
10
9
|
See:
|
10
|
+
|
11
11
|
* http://developer.apple.com/macosx/launchd.html
|
12
12
|
* http://launchd.macosforge.org/
|
13
13
|
|
14
14
|
This provider reads plists out of the following directories:
|
15
|
+
|
15
16
|
* /System/Library/LaunchDaemons
|
16
17
|
* /System/Library/LaunchAgents
|
17
18
|
* /Library/LaunchDaemons
|
18
19
|
* /Library/LaunchAgents
|
19
20
|
|
20
|
-
and builds up a list of services based upon each
|
21
|
+
...and builds up a list of services based upon each plist's \"Label\" entry.
|
21
22
|
|
22
23
|
This provider supports:
|
24
|
+
|
23
25
|
* ensure => running/stopped,
|
24
26
|
* enable => true/false
|
25
27
|
* status
|
26
28
|
* restart
|
27
29
|
|
28
30
|
Here is how the Puppet states correspond to launchd states:
|
29
|
-
|
30
|
-
*
|
31
|
-
*
|
32
|
-
*
|
31
|
+
|
32
|
+
* stopped --- job unloaded
|
33
|
+
* started --- job loaded
|
34
|
+
* enabled --- 'Disable' removed from job plist file
|
35
|
+
* disabled --- 'Disable' added to job plist file
|
33
36
|
|
34
37
|
Note that this allows you to do something launchctl can't do, which is to
|
35
38
|
be in a state of \"stopped/enabled\ or \"running/disabled\".
|
@@ -18,10 +18,10 @@ Puppet::Type.type(:service).provide :runit, :parent => :daemontools do
|
|
18
18
|
|
19
19
|
or this can be overriden in the service resource parameters::
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
service { \"myservice\":
|
22
|
+
provider => \"runit\",
|
23
|
+
path => \"/path/to/daemons\",
|
24
|
+
}
|
25
25
|
|
26
26
|
This provider supports out of the box:
|
27
27
|
|
@@ -19,7 +19,7 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
|
|
19
19
|
value !~ /\s/
|
20
20
|
end
|
21
21
|
|
22
|
-
has_features :manages_homedir, :allows_duplicates, :manages_expiry
|
22
|
+
has_features :manages_homedir, :allows_duplicates, :manages_expiry, :system_users
|
23
23
|
|
24
24
|
has_features :manages_passwords, :manages_password_age if Puppet.features.libshadow?
|
25
25
|
|
@@ -46,6 +46,10 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
|
|
46
46
|
cmd
|
47
47
|
end
|
48
48
|
|
49
|
+
def check_system_users
|
50
|
+
@resource.system? ? ["-r"] : []
|
51
|
+
end
|
52
|
+
|
49
53
|
def add_properties
|
50
54
|
cmd = []
|
51
55
|
Puppet::Type.type(:user).validproperties.each do |property|
|
@@ -66,6 +70,7 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
|
|
66
70
|
cmd += check_allow_dup
|
67
71
|
cmd += check_manage_home
|
68
72
|
cmd += check_manage_expiry
|
73
|
+
cmd += check_system_users
|
69
74
|
cmd << @resource[:name]
|
70
75
|
end
|
71
76
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class AddInventoryServiceTables < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
unless ActiveRecord::Base.connection.tables.include?("inventory_nodes")
|
4
|
+
create_table :inventory_nodes do |t|
|
5
|
+
t.column :name, :string, :null => false
|
6
|
+
t.column :timestamp, :datetime, :null => false
|
7
|
+
t.column :updated_at, :datetime
|
8
|
+
t.column :created_at, :datetime
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :inventory_nodes, :name, :unique => true
|
12
|
+
end
|
13
|
+
|
14
|
+
unless ActiveRecord::Base.connection.tables.include?("inventory_facts")
|
15
|
+
create_table :inventory_facts, :id => false do |t|
|
16
|
+
t.column :node_id, :integer, :null => false
|
17
|
+
t.column :name, :string, :null => false
|
18
|
+
t.column :value, :text, :null => false
|
19
|
+
end
|
20
|
+
|
21
|
+
add_index :inventory_facts, [:node_id, :name], :unique => true
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.down
|
26
|
+
unless ActiveRecord::Base.connection.tables.include?("inventory_nodes")
|
27
|
+
remove_index :inventory_nodes, :name
|
28
|
+
drop_table :inventory_nodes
|
29
|
+
end
|
30
|
+
|
31
|
+
if ActiveRecord::Base.connection.tables.include?("inventory_facts")
|
32
|
+
remove_index :inventory_facts, [:node_id, :name]
|
33
|
+
drop_table :inventory_facts
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -103,6 +103,23 @@ class Puppet::Rails::Schema
|
|
103
103
|
t.column :created_at, :datetime
|
104
104
|
end
|
105
105
|
add_index :param_names, :name
|
106
|
+
|
107
|
+
create_table :inventory_nodes do |t|
|
108
|
+
t.column :name, :string, :null => false
|
109
|
+
t.column :timestamp, :datetime, :null => false
|
110
|
+
t.column :updated_at, :datetime
|
111
|
+
t.column :created_at, :datetime
|
112
|
+
end
|
113
|
+
|
114
|
+
add_index :inventory_nodes, :name, :unique => true
|
115
|
+
|
116
|
+
create_table :inventory_facts, :id => false do |t|
|
117
|
+
t.column :node_id, :integer, :null => false
|
118
|
+
t.column :name, :string, :null => false
|
119
|
+
t.column :value, :text, :null => false
|
120
|
+
end
|
121
|
+
|
122
|
+
add_index :inventory_facts, [:node_id, :name], :unique => true
|
106
123
|
end
|
107
124
|
end
|
108
125
|
ensure
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'puppet/rails/inventory_fact'
|
2
|
+
|
3
|
+
class Puppet::Rails::InventoryNode < ::ActiveRecord::Base
|
4
|
+
has_many :facts, :class_name => "Puppet::Rails::InventoryFact", :foreign_key => :node_id, :dependent => :delete_all
|
5
|
+
|
6
|
+
named_scope :has_fact_with_value, lambda { |name,value|
|
7
|
+
{
|
8
|
+
:conditions => ["inventory_facts.name = ? AND inventory_facts.value = ?", name, value],
|
9
|
+
:joins => :facts
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
named_scope :has_fact_without_value, lambda { |name,value|
|
14
|
+
{
|
15
|
+
:conditions => ["inventory_facts.name = ? AND inventory_facts.value != ?", name, value],
|
16
|
+
:joins => :facts
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
def facts_to_hash
|
21
|
+
facts.inject({}) do |fact_hash,fact|
|
22
|
+
fact_hash.merge(fact.name => fact.value)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -122,7 +122,7 @@ likewise be redirected to a file:
|
|
122
122
|
Puppet can also create user and group accounts for itself (one `puppet` group
|
123
123
|
and one `puppet` user) if it is invoked as `root` with the `--mkusers` argument:
|
124
124
|
|
125
|
-
$ puppet
|
125
|
+
$ puppet master --mkusers
|
126
126
|
|
127
127
|
## Signals
|
128
128
|
|
@@ -29,7 +29,7 @@ in your manifest, including defined components.
|
|
29
29
|
params.sort { |a,b|
|
30
30
|
a.to_s <=> b.to_s
|
31
31
|
}.each { |param|
|
32
|
-
str += paramwrap(param.to_s, scrub(Puppet::Type.metaparamdoc(param)), :level =>
|
32
|
+
str += paramwrap(param.to_s, scrub(Puppet::Type.metaparamdoc(param)), :level => 3)
|
33
33
|
}
|
34
34
|
rescue => detail
|
35
35
|
puts detail.backtrace
|
data/lib/puppet/reports/store.rb
CHANGED
@@ -15,7 +15,10 @@ Puppet::Reports.register_report(:store) do
|
|
15
15
|
|
16
16
|
dir = File.join(Puppet[:reportdir], client)
|
17
17
|
|
18
|
-
|
18
|
+
if ! FileTest.exists?(dir)
|
19
|
+
FileUtils.mkdir_p(dir)
|
20
|
+
FileUtils.chmod_R(0750, dir)
|
21
|
+
end
|
19
22
|
|
20
23
|
# Now store the report.
|
21
24
|
now = Time.now.gmtime
|