diff options
author | James Turnbull <james@lovedthanlost.net> | 2010-08-12 15:33:14 +1000 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2010-08-12 15:35:19 +1000 |
commit | 252c9b84f79307e5caa50b50e093ad493993622d (patch) | |
tree | abce1a16ae21d4f9b73ef17d086af39b885e2806 /lib | |
parent | 1157e8dbaf310cca6f56dda3fa9f100b458662ee (diff) | |
download | puppet-252c9b84f79307e5caa50b50e093ad493993622d.tar.gz puppet-252c9b84f79307e5caa50b50e093ad493993622d.tar.xz puppet-252c9b84f79307e5caa50b50e093ad493993622d.zip |
Further RST to Markdown fixes for types, values, tests
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/application/doc.rb | 28 | ||||
-rw-r--r-- | lib/puppet/indirector/facts/memory.rb | 2 | ||||
-rw-r--r-- | lib/puppet/indirector/node/memory.rb | 2 | ||||
-rw-r--r-- | lib/puppet/parameter/value_collection.rb | 6 | ||||
-rw-r--r-- | lib/puppet/property.rb | 10 | ||||
-rw-r--r-- | lib/puppet/provider.rb | 6 | ||||
-rw-r--r-- | lib/puppet/reference/providers.rb | 4 | ||||
-rw-r--r-- | lib/puppet/type.rb | 170 | ||||
-rw-r--r-- | lib/puppet/type/zone.rb | 12 | ||||
-rwxr-xr-x | lib/puppet/type/zpool.rb | 8 | ||||
-rwxr-xr-x | lib/puppet/util/command_line/puppetdoc | 10 | ||||
-rwxr-xr-x | lib/puppet/util/command_line/ralsh | 26 | ||||
-rw-r--r-- | lib/puppet/util/docs.rb | 1 | ||||
-rw-r--r-- | lib/puppet/util/reference.rb | 28 |
14 files changed, 130 insertions, 183 deletions
diff --git a/lib/puppet/application/doc.rb b/lib/puppet/application/doc.rb index 6ebb47563..1f6c63286 100644 --- a/lib/puppet/application/doc.rb +++ b/lib/puppet/application/doc.rb @@ -56,7 +56,7 @@ class Puppet::Application::Doc < Puppet::Application end def run_command - return[:rdoc, :markdown].include?(options[:mode]) ? send(options[:mode]) : other + return[:rdoc].include?(options[:mode]) ? send(options[:mode]) : other end def rdoc @@ -92,32 +92,6 @@ class Puppet::Application::Doc < Puppet::Application exit exit_code end - def markdown - text = "" - with_contents = false - exit_code = 0 - require 'puppet/util/reference' - options[:references].sort { |a,b| a.to_s <=> b.to_s }.each do |name| - raise "Could not find reference #{name}" unless section = Puppet::Util::Reference.reference(name) - - begin - # Add the per-section text, but with no ToC - text += section.send(options[:format], with_contents) - text += Puppet::Util::Reference.footer - text.gsub!(/`\w+\s+([^`]+)`:trac:/) { |m| $1 } - Puppet::Util::Reference.markdown(name, text) - text = "" - rescue => detail - puts detail.backtrace - $stderr.puts "Could not generate reference #{name}: #{detail}" - exit_code = 1 - next - end - end - - exit exit_code - end - def other text = "" with_contents = options[:references].length <= 1 diff --git a/lib/puppet/indirector/facts/memory.rb b/lib/puppet/indirector/facts/memory.rb index c4ca19da5..93682f456 100644 --- a/lib/puppet/indirector/facts/memory.rb +++ b/lib/puppet/indirector/facts/memory.rb @@ -3,7 +3,7 @@ require 'puppet/indirector/memory' class Puppet::Node::Facts::Memory < Puppet::Indirector::Memory desc "Keep track of facts in memory but nowhere else. This is used for - one-time compiles, such as what the stand-alone ``puppet`` does. + one-time compiles, such as what the stand-alone `puppet` does. To use this terminus, you must load it with the data you want it to contain." end diff --git a/lib/puppet/indirector/node/memory.rb b/lib/puppet/indirector/node/memory.rb index ce4a52a8f..029926af8 100644 --- a/lib/puppet/indirector/node/memory.rb +++ b/lib/puppet/indirector/node/memory.rb @@ -3,7 +3,7 @@ require 'puppet/indirector/memory' class Puppet::Node::Memory < Puppet::Indirector::Memory desc "Keep track of nodes in memory but nowhere else. This is used for - one-time compiles, such as what the stand-alone ``puppet`` does. + one-time compiles, such as what the stand-alone `puppet` does. To use this terminus, you must load it with the data you want it to contain; it is only useful for developers and should generally not be chosen by a normal user." diff --git a/lib/puppet/parameter/value_collection.rb b/lib/puppet/parameter/value_collection.rb index a9fd20233..619e0731d 100644 --- a/lib/puppet/parameter/value_collection.rb +++ b/lib/puppet/parameter/value_collection.rb @@ -21,14 +21,14 @@ class Puppet::Parameter::ValueCollection @doc += " Valid values are " @doc += @strings.collect do |value| if aliases = value.aliases and ! aliases.empty? - "``#{value.name}`` (also called ``#{aliases.join(", ")}``)" + "`#{value.name}` (also called `#{aliases.join(", ")}`)" else - "``#{value.name}``" + "`#{value.name}`" end end.join(", ") + "." end - @doc += " Values can match ``" + regexes.join("``, ``") + "``." unless regexes.empty? + @doc += " Values can match `" + regexes.join("`, `") + "`." unless regexes.empty? end @doc diff --git a/lib/puppet/property.rb b/lib/puppet/property.rb index 282a52cf4..84e1a0360 100644 --- a/lib/puppet/property.rb +++ b/lib/puppet/property.rb @@ -55,10 +55,10 @@ class Puppet::Property < Puppet::Parameter # * <tt>:required_features</tt>: A list of features this value requires. # * <tt>:event</tt>: The event that should be returned when this value is set. # * <tt>:call</tt>: When to call any associated block. The default value - # is ``instead``, which means to call the value instead of calling the - # provider. You can also specify ``before`` or ``after``, which will + # is `instead`, which means to call the value instead of calling the + # provider. You can also specify `before` or `after`, which will # call both the block and the provider, according to the order you specify - # (the ``first`` refers to when the block is called, not the provider). + # (the `first` refers to when the block is called, not the provider). def self.newvalue(name, options = {}, &block) value = value_collection.newvalue(name, options, &block) @@ -181,10 +181,10 @@ class Puppet::Property < Puppet::Parameter def log(msg) Puppet::Util::Log.create( - + :level => resource[:loglevel], :message => msg, - + :source => self ) end diff --git a/lib/puppet/provider.rb b/lib/puppet/provider.rb index 8f993dbc1..af792b623 100644 --- a/lib/puppet/provider.rb +++ b/lib/puppet/provider.rb @@ -205,7 +205,7 @@ class Puppet::Provider dochook(:defaults) do if @defaults.length > 0 return " Default for " + @defaults.collect do |f, v| - "``#{f}`` == ``#{v}``" + "`#{f}` == `#{v}`" end.join(" and ") + "." end end @@ -213,7 +213,7 @@ class Puppet::Provider dochook(:commands) do if @commands.length > 0 return " Required binaries: " + @commands.collect do |n, c| - "``#{c}``" + "`#{c}`" end.join(", ") + "." end end @@ -221,7 +221,7 @@ class Puppet::Provider dochook(:features) do if features.length > 0 return " Supported features: " + features.collect do |f| - "``#{f}``" + "`#{f}`" end.join(", ") + "." end end diff --git a/lib/puppet/reference/providers.rb b/lib/puppet/reference/providers.rb index b44b26a51..c85ad23ab 100644 --- a/lib/puppet/reference/providers.rb +++ b/lib/puppet/reference/providers.rb @@ -95,7 +95,7 @@ providers = Puppet::Util::Reference.newreference :providers, :title => "Provider ret += h(type.name.to_s + "_", 2) - ret += ".. _#{type.name}: #{"http://docs.puppetlabs.com/references/stable/type.html##{type.name}"}\n\n" + ret += "[#{type.name}](#{"http://docs.puppetlabs.com/references/stable/type.html##{type.name}"})\n\n" ret += option("Default provider", default) ret += doctable(headers, table_data) @@ -111,7 +111,7 @@ providers = Puppet::Util::Reference.newreference :providers, :title => "Provider ret end providers.header = " -Puppet resource types are usually backed by multiple implementations called ``providers``, +Puppet resource types are usually backed by multiple implementations called `providers`, which handle variance between platforms and tools. Different providers are suitable or unsuitable on different platforms based on things diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index c3855a400..53c23aa32 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -933,16 +933,16 @@ class Type newmetaparam(:schedule) do desc "On what schedule the object should be managed. You must create a schedule object, and then reference the name of that object to use - that for your schedule:: + that for your schedule: - schedule { daily: - period => daily, - range => \"2-4\" - } + schedule { daily: + period => daily, + range => \"2-4\" + } - exec { \"/usr/bin/apt-get update\": - schedule => daily - } + exec { \"/usr/bin/apt-get update\": + schedule => daily + } The creation of the schedule object does not need to appear in the configuration before objects that use it." @@ -1020,40 +1020,40 @@ class Type newmetaparam(:alias) do desc "Creates an alias for the object. Puppet uses this internally when you - provide a symbolic name:: - - file { sshdconfig: - path => $operatingsystem ? { - solaris => \"/usr/local/etc/ssh/sshd_config\", - default => \"/etc/ssh/sshd_config\" - }, - source => \"...\" - } + provide a symbolic name: + + file { sshdconfig: + path => $operatingsystem ? { + solaris => \"/usr/local/etc/ssh/sshd_config\", + default => \"/etc/ssh/sshd_config\" + }, + source => \"...\" + } - service { sshd: - subscribe => file[sshdconfig] - } + service { sshd: + subscribe => file[sshdconfig] + } - When you use this feature, the parser sets ``sshdconfig`` as the name, + When you use this feature, the parser sets `sshdconfig` as the name, and the library sets that as an alias for the file so the dependency - lookup for ``sshd`` works. You can use this parameter yourself, + lookup for `sshd` works. You can use this parameter yourself, but note that only the library can use these aliases; for instance, - the following code will not work:: + the following code will not work: - file { \"/etc/ssh/sshd_config\": - owner => root, - group => root, - alias => sshdconfig - } + file { \"/etc/ssh/sshd_config\": + owner => root, + group => root, + alias => sshdconfig + } - file { sshdconfig: - mode => 644 - } + file { sshdconfig: + mode => 644 + } There's no way here for the Puppet parser to know that these two stanzas should be affecting the same file. - See the `LanguageTutorial language tutorial`:trac: for more information. + See the [Language Tutorial](http://docs.puppetlabs.com/guides/language_tutorial.html) for more information. " @@ -1083,9 +1083,9 @@ class Type be useful to add your own tags to a given resource. Tags are currently useful for things like applying a subset of a - host's configuration:: + host's configuration: - puppet agent --test --tags mytag + puppet agent --test --tags mytag This way, when you're testing a configuration you can run just the portion you're testing." @@ -1189,23 +1189,23 @@ class Type newmetaparam(:require, :parent => RelationshipMetaparam, :attributes => {:direction => :in, :events => :NONE}) do desc "One or more objects that this object depends on. This is used purely for guaranteeing that changes to required objects - happen before the dependent object. For instance:: + happen before the dependent object. For instance: - # Create the destination directory before you copy things down - file { \"/usr/local/scripts\": - ensure => directory - } + # Create the destination directory before you copy things down + file { \"/usr/local/scripts\": + ensure => directory + } - file { \"/usr/local/scripts/myscript\": - source => \"puppet://server/module/myscript\", - mode => 755, - require => File[\"/usr/local/scripts\"] - } + file { \"/usr/local/scripts/myscript\": + source => \"puppet://server/module/myscript\", + mode => 755, + require => File[\"/usr/local/scripts\"] + } Multiple dependencies can be specified by providing a comma-seperated list - of resources, enclosed in square brackets:: + of resources, enclosed in square brackets: - require => [ File[\"/usr/local\"], File[\"/usr/local/scripts\"] ] + require => [ File[\"/usr/local\"], File[\"/usr/local/scripts\"] ] Note that Puppet will autorequire everything that it can, and there are hooks in place so that it's easy for resources to add new @@ -1219,10 +1219,10 @@ class Type Currently, exec resources will autorequire their CWD (if it is specified) plus any fully qualified paths that appear in the - command. For instance, if you had an ``exec`` command that ran - the ``myscript`` mentioned above, the above code that pulls the + command. For instance, if you had an `exec` command that ran + the `myscript` mentioned above, the above code that pulls the file down would be automatically listed as a requirement to the - ``exec`` code, so that you would always be running againts the + `exec` code, so that you would always be running againts the most recent version. " end @@ -1230,20 +1230,20 @@ class Type newmetaparam(:subscribe, :parent => RelationshipMetaparam, :attributes => {:direction => :in, :events => :ALL_EVENTS, :callback => :refresh}) do desc "One or more objects that this object depends on. Changes in the subscribed to objects result in the dependent objects being - refreshed (e.g., a service will get restarted). For instance:: - - class nagios { - file { \"/etc/nagios/nagios.conf\": - source => \"puppet://server/module/nagios.conf\", - alias => nagconf # just to make things easier for me + refreshed (e.g., a service will get restarted). For instance: + + class nagios { + file { \"/etc/nagios/nagios.conf\": + source => \"puppet://server/module/nagios.conf\", + alias => nagconf # just to make things easier for me + } + service { nagios: + ensure => running, + subscribe => File[nagconf] + } } - service { nagios: - ensure => running, - subscribe => File[nagconf] - } - } - Currently the ``exec``, ``mount`` and ``service`` type support + Currently the `exec`, `mount` and `service` type support refreshing. " end @@ -1251,18 +1251,18 @@ class Type newmetaparam(:before, :parent => RelationshipMetaparam, :attributes => {:direction => :out, :events => :NONE}) do desc %{This parameter is the opposite of **require** -- it guarantees that the specified object is applied later than the specifying - object:: + object: - file { "/var/nagios/configuration": - source => "...", - recurse => true, - before => Exec["nagios-rebuid"] - } + file { "/var/nagios/configuration": + source => "...", + recurse => true, + before => Exec["nagios-rebuid"] + } - exec { "nagios-rebuild": - command => "/usr/bin/make", - cwd => "/var/nagios/configuration" - } + exec { "nagios-rebuild": + command => "/usr/bin/make", + cwd => "/var/nagios/configuration" + } This will make sure all of the files are up to date before the make command is run.} @@ -1270,16 +1270,16 @@ class Type newmetaparam(:notify, :parent => RelationshipMetaparam, :attributes => {:direction => :out, :events => :ALL_EVENTS, :callback => :refresh}) do desc %{This parameter is the opposite of **subscribe** -- it sends events - to the specified object:: + to the specified object: - file { "/etc/sshd_config": - source => "....", - notify => Service[sshd] - } + file { "/etc/sshd_config": + source => "....", + notify => Service[sshd] + } - service { sshd: - ensure => running - } + service { sshd: + ensure => running + } This will restart the sshd service if the sshd config file changes.} end @@ -1293,24 +1293,24 @@ class Type By default, all classes get directly added to the 'main' stage. You can create new stages as resources: - stage { [pre, post]: } + stage { [pre, post]: } To order stages, use standard relationships: - stage { pre: before => Stage[main] } + stage { pre: before => Stage[main] } Or use the new relationship syntax: - Stage[pre] -> Stage[main] -> Stage[post] + Stage[pre] -> Stage[main] -> Stage[post] Then use the new class parameters to specify a stage: - class { foo: stage => pre } + class { foo: stage => pre } Stages can only be set on classes, not individual resources. This will - fail:: + fail: - file { '/foo': stage => pre, ensure => file } + file { '/foo': stage => pre, ensure => file } } end diff --git a/lib/puppet/type/zone.rb b/lib/puppet/type/zone.rb index 5265b8a0f..408d6f5dd 100644 --- a/lib/puppet/type/zone.rb +++ b/lib/puppet/type/zone.rb @@ -320,14 +320,14 @@ Puppet::Type.newtype(:zone) do timezone=GMT terminal=xterms security_policy=NONE - root_password=<%= password %> + root_password=<%= password %> timeserver=localhost - name_service=DNS {domain_name=<%= domain %> name_server=<%= nameserver %>} - network_interface=primary {hostname=<%= realhostname %> - ip_address=<%= ip %> - netmask=<%= netmask %> + name_service=DNS {domain_name=<%= domain %> name_server=<%= nameserver %>} + network_interface=primary {hostname=<%= realhostname %> + ip_address=<%= ip %> + netmask=<%= netmask %> protocol_ipv6=no - default_route=<%= defaultroute %>} + default_route=<%= defaultroute %>} nfs4_domain=dynamic And then call that: diff --git a/lib/puppet/type/zpool.rb b/lib/puppet/type/zpool.rb index 401a2c220..49cce552a 100755 --- a/lib/puppet/type/zpool.rb +++ b/lib/puppet/type/zpool.rb @@ -45,9 +45,9 @@ module Puppet newproperty(:mirror, :array_matching => :all, :parent => Puppet::Property::MultiVDev) do desc "List of all the devices to mirror for this pool. Each mirror should be a space separated string: - + mirror => [\"disk1 disk2\", \"disk3 disk4\"] - + " validate do |value| @@ -57,8 +57,8 @@ module Puppet newproperty(:raidz, :array_matching => :all, :parent => Puppet::Property::MultiVDev) do desc "List of all the devices to raid for this pool. Should be an array of space separated strings: - - raidz => [\"disk1 disk2\", \"disk3 disk4\"] + + raidz => [\"disk1 disk2\", \"disk3 disk4\"] " diff --git a/lib/puppet/util/command_line/puppetdoc b/lib/puppet/util/command_line/puppetdoc index d9bbbec33..0fa1830d6 100755 --- a/lib/puppet/util/command_line/puppetdoc +++ b/lib/puppet/util/command_line/puppetdoc @@ -8,15 +8,15 @@ # # = Usage # -# puppet doc [-a|--all] [-h|--help] [-o|--outputdir <rdoc outputdir>] [-m|--mode <text|pdf|markdown|trac|rdoc>] +# puppet doc [-a|--all] [-h|--help] [-o|--outputdir <rdoc outputdir>] [-m|--mode <text|pdf|rdoc>] # [-r|--reference <[type]|configuration|..>] [--charset CHARSET] [manifest-file] # # = Description # -# If mode is not 'rdoc', then this command generates a restructured-text document describing all installed +# If mode is not 'rdoc', then this command generates a Markdown document describing all installed # Puppet types or all allowable arguments to puppet executables. It is largely # meant for internal use and is used to generate the reference document -# available on the Reductive Labs web site. +# available on the Puppet Labs web site. # # In 'rdoc' mode, this command generates an html RDoc hierarchy describing the manifests that # are in 'manifestdir' and 'modulepath' configuration directives. @@ -37,7 +37,7 @@ # Specifies the directory where to output the rdoc documentation in 'rdoc' mode. # # mode:: -# Determine the output mode. Valid modes are 'text', 'trac', 'pdf', 'markdown' and 'rdoc'. The 'pdf' and 'markdown' modes create PDF or Markdown formatted files in the /tmp directory. Note that 'trac' mode only works on Reductive Labs servers. The default mode is 'text'. In 'rdoc' mode you must provide 'manifests-path' +# Determine the output mode. Valid modes are 'text', 'trac', 'pdf' and 'rdoc'. The 'pdf' mode creates PDF formatted files in the /tmp directory. The default mode is 'text'. In 'rdoc' mode you must provide 'manifests-path' # # reference:: # Build a particular reference. Get a list of references by running +puppet doc --list+. @@ -53,7 +53,7 @@ # or # $ puppet doc /etc/puppet/manifests/site.pp # or -# $ puppet doc -m markdown -r configuration +# $ puppet doc -m pdf -r configuration # # = Author # diff --git a/lib/puppet/util/command_line/ralsh b/lib/puppet/util/command_line/ralsh index 68ad92d84..83338fcbc 100755 --- a/lib/puppet/util/command_line/ralsh +++ b/lib/puppet/util/command_line/ralsh @@ -59,23 +59,23 @@ # types: # List all available types. # -# verbose:: +# verbose: # Print extra information. # # = Example # -# This example uses ``puppet resource`` to return Puppet configuration for the user ``luke``:: -# -# $ puppet resource user luke -# user { 'luke': -# home => '/home/luke', -# uid => '100', -# ensure => 'present', -# comment => 'Luke Kanies,,,', -# gid => '1000', -# shell => '/bin/bash', -# groups => ['sysadmin','audio','video','puppet'] -# } +# This example uses `puppet resource` to return Puppet configuration for the user `luke`: +# +# $ puppet resource user luke +# user { 'luke': +# home => '/home/luke', +# uid => '100', +# ensure => 'present', +# comment => 'Luke Kanies,,,', +# gid => '1000', +# shell => '/bin/bash', +# groups => ['sysadmin','audio','video','puppet'] +# } # # = Author # diff --git a/lib/puppet/util/docs.rb b/lib/puppet/util/docs.rb index 1746ef3fc..4344d67ab 100644 --- a/lib/puppet/util/docs.rb +++ b/lib/puppet/util/docs.rb @@ -105,4 +105,3 @@ module Puppet::Util::Docs module_function :scrub end - diff --git a/lib/puppet/util/reference.rb b/lib/puppet/util/reference.rb index 00390746e..4f2058e69 100644 --- a/lib/puppet/util/reference.rb +++ b/lib/puppet/util/reference.rb @@ -15,7 +15,7 @@ class Puppet::Util::Reference end def self.modes - %w{pdf text markdown} + %w{pdf text} end def self.newreference(name, options = {}, &block) @@ -67,32 +67,6 @@ class Puppet::Util::Reference end - def self.markdown(name, text) - puts "Creating markdown for #{name} reference." - dir = "/tmp/#{Puppet::PUPPETVERSION}" - FileUtils.mkdir(dir) unless File.directory?(dir) - Puppet::Util.secure_open(dir + "/#{name}.rst", "w") do |f| - f.puts text - end - pandoc = %x{which pandoc} - if $CHILD_STATUS != 0 or pandoc =~ /no / - pandoc = %x{which pandoc} - end - if $CHILD_STATUS != 0 or pandoc =~ /no / - raise "Could not find pandoc" - end - pandoc.chomp! - cmd = %{#{pandoc} -s -r rst -w markdown #{dir}/#{name}.rst -o #{dir}/#{name}.mdwn} - output = %x{#{cmd}} - unless $CHILD_STATUS == 0 - $stderr.puts "Pandoc failed to create #{name} reference." - $stderr.puts output - exit(1) - end - - File.unlink(dir + "/#{name}.rst") - end - def self.references instance_loader(:reference).loadall loaded_instances(:reference).sort { |a,b| a.to_s <=> b.to_s } |