[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5
Luke Kanies
luke at puppetlabs.com
Tue May 10 08:05:10 UTC 2011
The following commit has been merged in the experimental branch:
commit ef289e5b036d7e9716d611af09d4414de42e31ed
Author: Luke Kanies <luke at puppetlabs.com>
Date: Mon Feb 21 20:51:40 2011 -0800
Fixing indentation
Signed-off-by: Luke Kanies <luke at puppetlabs.com>
diff --git a/README.markdown b/README.markdown
index 56bc2ab..56d9c7a 100644
--- a/README.markdown
+++ b/README.markdown
@@ -22,28 +22,28 @@ Usage
-----
The general usage is:
- $ puppet <interface> <verb> <name>
+ $ puppet <interface> <verb> <name>
So, e.g.:
- $ puppet facts find myhost.domain.com
- $ puppet node destroy myhost
+ $ puppet facts find myhost.domain.com
+ $ puppet node destroy myhost
You can use it to list all known data types and the available terminus classes:
- $ puppet interface list
- catalog : active_record, compiler, queue, rest, yaml
- certificate : ca, file, rest
- certificate_request : ca, file, rest
- certificate_revocation_list : ca, file, rest
- file_bucket_file : file, rest
- inventory : yaml
- key : ca, file
- node : active_record, exec, ldap, memory, plain, rest, yaml
- report : processor, rest, yaml
- resource : ral, rest
- resource_type : parser, rest
- status : local, rest
+ $ puppet interface list
+ catalog : active_record, compiler, queue, rest, yaml
+ certificate : ca, file, rest
+ certificate_request : ca, file, rest
+ certificate_revocation_list : ca, file, rest
+ file_bucket_file : file, rest
+ inventory : yaml
+ key : ca, file
+ node : active_record, exec, ldap, memory, plain, rest, yaml
+ report : processor, rest, yaml
+ resource : ral, rest
+ resource_type : parser, rest
+ status : local, rest
But most interestingly, you can use it for two main purposes:
@@ -52,41 +52,41 @@ But most interestingly, you can use it for two main purposes:
A simple case is looking at the local facts:
- $ puppet facts find localhost
+ $ puppet facts find localhost
If you're on the server, you can look in that server's fact collection:
- $ puppet facts --mode master --vardir /tmp/foo --from yaml find localhost
+ $ puppet facts --mode master --vardir /tmp/foo --from yaml find localhost
Note that we're setting both the vardir and the 'mode', which switches from the default 'agent' mode to server mode (requires a patch in my branch).
If you'd prefer the data be outputted in json instead of yaml, well, you can do that, too:
- $ puppet find --mode master facts --vardir /tmp/foo --from yaml --format pson localhost
+ $ puppet find --mode master facts --vardir /tmp/foo --from yaml --format pson localhost
To test using it as an endpoint for compiling and retrieving catalogs from a remote server, (from my commit), try this:
- # Terminal 1
- $ sbin/puppetmasterd --trace --confdir /tmp/foo --vardir /tmp/foo --debug --manifest ~/bin/test.pp --certname localhost --no-daemonize
-
- # Terminal 2
- $ sbin/puppetd --trace --debug --confdir /tmp/foo --vardir /tmp/foo --certname localhost --server localhost --test --report
-
- # Terminal 3, actual testing
- $ puppet data --certname localhost --server localhost --mode master --confdir /tmp/foo --vardir /tmp/foo --trace --from rest catalog find localhost
+ # Terminal 1
+ $ sbin/puppetmasterd --trace --confdir /tmp/foo --vardir /tmp/foo --debug --manifest ~/bin/test.pp --certname localhost --no-daemonize
+
+ # Terminal 2
+ $ sbin/puppetd --trace --debug --confdir /tmp/foo --vardir /tmp/foo --certname localhost --server localhost --test --report
+
+ # Terminal 3, actual testing
+ $ puppet data --certname localhost --server localhost --mode master --confdir /tmp/foo --vardir /tmp/foo --trace --from rest catalog find localhost
This compiles a test catalog (assuming that ~/bin/test.pp exists) and returns it. With the right auth setup, you can also get facts:
- $ puppet facts --certname localhost --server localhost --mode master --confdir /tmp/foo --vardir /tmp/foo --trace --from rest find localhost
+ $ puppet facts --certname localhost --server localhost --mode master --confdir /tmp/foo --vardir /tmp/foo --trace --from rest find localhost
Or use IRB to do the same thing:
- $ irb
- >> require 'puppet/interface'
- => true
- >> interface = Puppet::Interface.interface(:facts).new
- => #<Puppet::Interface::Facts:0x1024a1390 @format=:yaml>
- >> facts = interface.find("myhost"); nil
+ $ irb
+ >> require 'puppet/interface'
+ => true
+ >> interface = Puppet::Interface.interface(:facts).new
+ => #<Puppet::Interface::Facts:0x1024a1390 @format=:yaml>
+ >> facts = interface.find("myhost"); nil
Like I said, a prototype, but I'd love it if people would play it with some and make some recommendations.
@@ -94,18 +94,18 @@ Extending
---------
Like most parts of Puppet, these are easy to extend. Just drop a new action into a given interface's directory. E.g.:
- $ cat lib/puppet/interface/catalog/select.rb
- # Select and show a list of resources of a given type.
- Puppet::Interface::Catalog.action :select do |*args|
- host = args.shift
- type = args.shift
- catalog = Puppet::Resource::Catalog.indirection.find(host)
-
- catalog.resources.reject { |res| res.type != type }.each { |res| puts res }
- end
- $ puppet catalog select localhost Class
- Class[main]
- Class[Settings]
- $
+ $ cat lib/puppet/interface/catalog/select.rb
+ # Select and show a list of resources of a given type.
+ Puppet::Interface::Catalog.action :select do |*args|
+ host = args.shift
+ type = args.shift
+ catalog = Puppet::Resource::Catalog.indirection.find(host)
+
+ catalog.resources.reject { |res| res.type != type }.each { |res| puts res }
+ end
+ $ puppet catalog select localhost Class
+ Class[main]
+ Class[Settings]
+ $
Notice that this gets loaded automatically when you try to use it. So, if you have a simple command you've written, such as for cleaning up nodes or diffing catalogs, you an port it to this framework and it should fit cleanly.
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list