puppet 5.1.0 → 5.2.0

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.

Files changed (108) hide show
  1. data/lib/puppet.rb +6 -53
  2. data/lib/puppet/application.rb +14 -7
  3. data/lib/puppet/application/agent.rb +6 -2
  4. data/lib/puppet/application/apply.rb +6 -2
  5. data/lib/puppet/application/cert.rb +6 -2
  6. data/lib/puppet/application/describe.rb +6 -2
  7. data/lib/puppet/application/device.rb +40 -29
  8. data/lib/puppet/application/doc.rb +6 -2
  9. data/lib/puppet/application/filebucket.rb +6 -2
  10. data/lib/puppet/application/lookup.rb +6 -2
  11. data/lib/puppet/application/master.rb +6 -2
  12. data/lib/puppet/application/resource.rb +6 -2
  13. data/lib/puppet/face/catalog.rb +1 -1
  14. data/lib/puppet/face/certificate_request.rb +1 -1
  15. data/lib/puppet/face/certificate_revocation_list.rb +1 -1
  16. data/lib/puppet/face/help.rb +17 -13
  17. data/lib/puppet/file_serving/configuration.rb +3 -0
  18. data/lib/puppet/file_serving/configuration/parser.rb +2 -0
  19. data/lib/puppet/file_serving/mount/tasks.rb +21 -0
  20. data/lib/puppet/functions/epp.rb +3 -0
  21. data/lib/puppet/functions/lookup.rb +2 -1
  22. data/lib/puppet/generate/models/type/property.rb +1 -1
  23. data/lib/puppet/gettext/config.rb +70 -0
  24. data/lib/puppet/gettext/stubs.rb +11 -0
  25. data/lib/puppet/indirector/request.rb +4 -4
  26. data/lib/puppet/info_service.rb +10 -0
  27. data/lib/puppet/info_service/task_information_service.rb +32 -0
  28. data/lib/puppet/module.rb +43 -12
  29. data/lib/puppet/module/task.rb +90 -0
  30. data/lib/puppet/parser/ast/leaf.rb +1 -1
  31. data/lib/puppet/parser/functions/dig.rb +11 -2
  32. data/lib/puppet/parser/functions/epp.rb +3 -0
  33. data/lib/puppet/parser/functions/new.rb +8 -8
  34. data/lib/puppet/pops/evaluator/evaluator_impl.rb +1 -1
  35. data/lib/puppet/pops/evaluator/runtime3_support.rb +1 -0
  36. data/lib/puppet/pops/issues.rb +11 -5
  37. data/lib/puppet/pops/loader/static_loader.rb +1 -1
  38. data/lib/puppet/pops/model/factory.rb +42 -2
  39. data/lib/puppet/pops/model/model_tree_dumper.rb +1 -1
  40. data/lib/puppet/pops/parser/egrammar.ra +30 -9
  41. data/lib/puppet/pops/parser/eparser.rb +1094 -1043
  42. data/lib/puppet/pops/patterns.rb +1 -1
  43. data/lib/puppet/pops/serialization/from_data_converter.rb +1 -1
  44. data/lib/puppet/pops/serialization/json_path.rb +1 -1
  45. data/lib/puppet/pops/serialization/to_data_converter.rb +12 -3
  46. data/lib/puppet/pops/types/p_object_type.rb +31 -3
  47. data/lib/puppet/pops/types/p_sem_ver_range_type.rb +3 -3
  48. data/lib/puppet/pops/types/p_timespan_type.rb +1 -1
  49. data/lib/puppet/pops/types/p_timestamp_type.rb +1 -1
  50. data/lib/puppet/pops/types/string_converter.rb +15 -12
  51. data/lib/puppet/pops/types/type_calculator.rb +1 -1
  52. data/lib/puppet/pops/types/type_factory.rb +7 -0
  53. data/lib/puppet/pops/types/type_formatter.rb +1 -1
  54. data/lib/puppet/pops/types/type_mismatch_describer.rb +86 -130
  55. data/lib/puppet/pops/types/type_parser.rb +10 -4
  56. data/lib/puppet/pops/types/types.rb +81 -22
  57. data/lib/puppet/provider/package/aix.rb +4 -4
  58. data/lib/puppet/provider/package/yum.rb +1 -0
  59. data/lib/puppet/type.rb +1 -1
  60. data/lib/puppet/type/mount.rb +1 -1
  61. data/lib/puppet/type/sshkey.rb +9 -1
  62. data/lib/puppet/util.rb +1 -1
  63. data/lib/puppet/util/command_line.rb +1 -1
  64. data/lib/puppet/util/log.rb +15 -10
  65. data/lib/puppet/util/windows/api_types.rb +9 -5
  66. data/lib/puppet/util/windows/process.rb +9 -1
  67. data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +1 -3
  68. data/lib/puppet/version.rb +1 -1
  69. data/locales/ja/puppet.po +9270 -0
  70. data/locales/puppet.pot +272 -212
  71. data/spec/fixtures/unit/provider/package/yum/yum-check-update-plugin-output.txt +36 -0
  72. data/spec/integration/indirector/file_content/file_server_spec.rb +17 -0
  73. data/spec/integration/indirector/file_metadata/file_server_spec.rb +10 -0
  74. data/spec/integration/util/windows/process_spec.rb +45 -0
  75. data/spec/lib/puppet_spec/modules.rb +10 -0
  76. data/spec/shared_contexts/types_setup.rb +19 -4
  77. data/spec/spec_helper.rb +6 -7
  78. data/spec/unit/face/help_spec.rb +2 -2
  79. data/spec/unit/file_serving/configuration_spec.rb +14 -4
  80. data/spec/unit/file_serving/mount/modules_spec.rb +1 -1
  81. data/spec/unit/file_serving/mount/tasks_spec.rb +72 -0
  82. data/spec/unit/functions/epp_spec.rb +5 -0
  83. data/spec/unit/functions/regsubst_spec.rb +1 -1
  84. data/spec/unit/gettext_config_spec.rb +57 -0
  85. data/spec/unit/indirector/request_spec.rb +41 -0
  86. data/spec/unit/info_service_spec.rb +66 -2
  87. data/spec/unit/module_spec.rb +81 -1
  88. data/spec/unit/parser/ast/leaf_spec.rb +3 -4
  89. data/spec/unit/pops/evaluator/access_ops_spec.rb +5 -0
  90. data/spec/unit/pops/factory_spec.rb +5 -1
  91. data/spec/unit/pops/parser/parser_spec.rb +138 -0
  92. data/spec/unit/pops/serialization/to_from_hr_spec.rb +74 -1
  93. data/spec/unit/pops/types/p_init_type_spec.rb +1 -1
  94. data/spec/unit/pops/types/p_object_type_spec.rb +217 -33
  95. data/spec/unit/pops/types/p_timespan_type_spec.rb +7 -0
  96. data/spec/unit/pops/types/p_timestamp_type_spec.rb +7 -0
  97. data/spec/unit/pops/types/string_converter_spec.rb +48 -11
  98. data/spec/unit/pops/types/type_calculator_spec.rb +37 -5
  99. data/spec/unit/pops/types/type_mismatch_describer_spec.rb +12 -0
  100. data/spec/unit/pops/types/type_parser_spec.rb +25 -0
  101. data/spec/unit/pops/validator/validator_spec.rb +2 -2
  102. data/spec/unit/provider/package/aix_spec.rb +26 -1
  103. data/spec/unit/provider/package/yum_spec.rb +10 -0
  104. data/spec/unit/task_spec.rb +102 -0
  105. data/spec/unit/util/log_spec.rb +32 -3
  106. data/spec/unit/util/windows/api_types_spec.rb +51 -0
  107. metadata +3472 -3448
  108. checksums.yaml +0 -7
data/lib/puppet.rb CHANGED
@@ -21,51 +21,7 @@ require 'puppet/util/run_mode'
21
21
  require 'puppet/external/pson/common'
22
22
  require 'puppet/external/pson/version'
23
23
  require 'puppet/external/pson/pure'
24
-
25
- # When running within puppetserver, the gettext-setup gem might not be available, so
26
- # we need to skip initializing i18n functionality and stub out methods normally
27
- # supplied by gettext-setup. Can be removed in Puppet 5. See PUP-7116.
28
- begin
29
- require 'gettext-setup'
30
- require 'locale'
31
-
32
- # e.g. ~/code/puppet/locales. Also when running as a gem.
33
- local_locale_path = File.absolute_path('../locales', File.dirname(__FILE__))
34
- # e.g. /opt/puppetlabs/puppet/share/locale
35
- posix_system_locale_path = File.absolute_path('../../../share/locale', File.dirname(__FILE__))
36
- # e.g. C:\Program Files\Puppet Labs\Puppet\puppet\share\locale
37
- win32_system_locale_path = File.absolute_path('../../../../../puppet/share/locale', File.dirname(__FILE__))
38
-
39
- if File.exist?(local_locale_path)
40
- locale_path = local_locale_path
41
- elsif Puppet::Util::Platform.windows? && File.exist?(win32_system_locale_path)
42
- locale_path = win32_system_locale_path
43
- elsif !Puppet::Util::Platform.windows? && File.exist?(posix_system_locale_path)
44
- locale_path = posix_system_locale_path
45
- else
46
- # We couldn't load our locale data.
47
- raise LoadError, "could not find locale data, skipping Gettext initialization"
48
- end
49
-
50
- Puppet::LOCALE_PATH = locale_path
51
- Puppet::GETTEXT_AVAILABLE = true
52
- rescue LoadError
53
- def _(msg)
54
- msg
55
- end
56
-
57
- def n_(*args, &block)
58
- # assume two string args (singular and plural English form) and the count
59
- # to pluralize on
60
- plural = args[2] == 1 ? args[0] : args[1]
61
- # if a block is passed, prefer that over the string selection above
62
- block ? block.call : plural
63
- end
64
-
65
- Puppet::LOCALE_PATH = nil
66
- Puppet::GETTEXT_AVAILABLE = false
67
- end
68
-
24
+ require 'puppet/gettext/config'
69
25
 
70
26
 
71
27
  #------------------------------------------------------------
@@ -86,14 +42,11 @@ module Puppet
86
42
  require 'puppet/environments'
87
43
 
88
44
  class << self
89
- if Puppet::GETTEXT_AVAILABLE && Puppet::LOCALE_PATH
90
- if GettextSetup.method(:initialize).parameters.count == 1
91
- # Will load translations from PO files only
92
- GettextSetup.initialize(Puppet::LOCALE_PATH)
93
- else
94
- GettextSetup.initialize(Puppet::LOCALE_PATH, :file_format => :mo)
95
- end
96
- FastGettext.locale = GettextSetup.negotiate_locale(Locale.current.language)
45
+ gettext_config_file = Puppet::GettextConfig.puppet_locale_path
46
+ unless Puppet::GettextConfig.initialize(gettext_config_file, Puppet::GettextConfig.translation_mode(gettext_config_file))
47
+ # Stub out gettext's `_` and `n_()` methods, which attempt to load translations,
48
+ # with versions that do nothing
49
+ require 'puppet/gettext/stubs'
97
50
  end
98
51
 
99
52
  include Puppet::Util
@@ -339,23 +339,23 @@ class Application
339
339
  # I don't really like the names of these lifecycle phases. It would be nice to change them to some more meaningful
340
340
  # names, and make deprecated aliases. --cprice 2012-03-16
341
341
 
342
- exit_on_fail(_("get application-specific default settings")) do
342
+ exit_on_fail(_("Could not get application-specific default settings")) do
343
343
  initialize_app_defaults
344
344
  end
345
345
 
346
346
  Puppet::ApplicationSupport.push_application_context(self.class.run_mode)
347
347
 
348
- exit_on_fail(_("initialize")) { preinit }
349
- exit_on_fail(_("parse application options")) { parse_options }
350
- exit_on_fail(_("prepare for execution")) { setup }
348
+ exit_on_fail(_("Could not initialize")) { preinit }
349
+ exit_on_fail(_("Could not parse application options")) { parse_options }
350
+ exit_on_fail(_("Could not prepare for execution")) { setup }
351
351
 
352
352
  if deprecated?
353
353
  Puppet.deprecation_warning(_("`puppet %{name}` is deprecated and will be removed in a future release.") % { name: name })
354
354
  end
355
355
 
356
- exit_on_fail(_("configure routes from %{route_file}") % { route_file: Puppet[:route_file] }) { configure_indirector_routes }
357
- exit_on_fail(_("log runtime debug info")) { log_runtime_environment }
358
- exit_on_fail(_("run")) { run_command }
356
+ exit_on_fail(_("Could not configure routes from %{route_file}") % { route_file: Puppet[:route_file] }) { configure_indirector_routes }
357
+ exit_on_fail(_("Could not log runtime debug info")) { log_runtime_environment }
358
+ exit_on_fail(_("Could not run")) { run_command }
359
359
  end
360
360
 
361
361
  def main
@@ -474,5 +474,12 @@ class Application
474
474
  def help
475
475
  _("No help available for puppet %{app_name}") % { app_name: name }
476
476
  end
477
+
478
+ # The description used in top level `puppet help` output
479
+ # If left empty in implementations, we will attempt to extract
480
+ # the summary from the help text itself.
481
+ def summary
482
+ ""
483
+ end
477
484
  end
478
485
  end
@@ -75,10 +75,14 @@ class Puppet::Application::Agent < Puppet::Application
75
75
  options[:job_id] = arg
76
76
  end
77
77
 
78
+ def summary
79
+ _("The puppet agent daemon")
80
+ end
81
+
78
82
  def help
79
- <<-'HELP'
83
+ <<-HELP
80
84
 
81
- puppet-agent(8) -- The puppet agent daemon
85
+ puppet-agent(8) -- #{summary}
82
86
  ========
83
87
 
84
88
  SYNOPSIS
@@ -31,10 +31,14 @@ class Puppet::Application::Apply < Puppet::Application
31
31
  exit 1
32
32
  end
33
33
 
34
+ def summary
35
+ _("Apply Puppet manifests locally")
36
+ end
37
+
34
38
  def help
35
- <<-'HELP'
39
+ <<-HELP
36
40
 
37
- puppet-apply(8) -- Apply Puppet manifests locally
41
+ puppet-apply(8) -- #{summary}
38
42
  ========
39
43
 
40
44
  SYNOPSIS
@@ -99,10 +99,14 @@ class Puppet::Application::Cert < Puppet::Application
99
99
  options[:yes] = true
100
100
  end
101
101
 
102
+ def summary
103
+ _("Manage certificates and requests")
104
+ end
105
+
102
106
  def help
103
- <<-'HELP'
107
+ <<-HELP
104
108
 
105
- puppet-cert(8) -- Manage certificates and requests
109
+ puppet-cert(8) -- #{summary}
106
110
  ========
107
111
 
108
112
  SYNOPSIS
@@ -178,10 +178,14 @@ class Puppet::Application::Describe < Puppet::Application
178
178
  option("--list", "-l")
179
179
  option("--meta","-m")
180
180
 
181
+ def summary
182
+ _("Display help about resource types")
183
+ end
184
+
181
185
  def help
182
- <<-'HELP'
186
+ <<-HELP
183
187
 
184
- puppet-describe(8) -- Display help about resource types
188
+ puppet-describe(8) -- #{summary}
185
189
  ========
186
190
 
187
191
  SYNOPSIS
@@ -62,59 +62,66 @@ class Puppet::Application::Device < Puppet::Application
62
62
  options[:target] = arg.to_s
63
63
  end
64
64
 
65
- def help
66
- <<-'HELP'
65
+ def summary
66
+ _("Manage remote network devices")
67
+ end
68
+
69
+ def help
70
+ <<-HELP
67
71
 
68
- puppet-device(8) -- Manage remote network devices
72
+ puppet-device(8) -- #{summary}
69
73
  ========
70
74
 
71
75
  SYNOPSIS
72
76
  --------
73
- Retrieves all configurations from the puppet master and apply
74
- them to the remote devices configured in /etc/puppetlabs/puppet/device.conf.
77
+ Retrieves catalogs from the Puppet master and applies them to remote devices.
78
+
79
+ This subcommand can be run manually; or periodically using cron,
80
+ a scheduled task, or a similar tool.
75
81
 
76
- Currently must be run out periodically, using cron or something similar.
77
82
 
78
83
  USAGE
79
84
  -----
80
85
  puppet device [-d|--debug] [--detailed-exitcodes] [--deviceconfig <file>]
81
86
  [-h|--help] [-l|--logdest syslog|<file>|console]
82
87
  [-v|--verbose] [-w|--waitforcert <seconds>]
83
- [-t|--target <device>] [-V|--version]
88
+ [-t|--target <device>] [--user=<user>] [-V|--version]
84
89
 
85
90
 
86
91
  DESCRIPTION
87
92
  -----------
88
- Once the client has a signed certificate for a given remote device, it will
89
- retrieve its configuration and apply it.
93
+ Devices require a proxy Puppet agent to request certificates, collect facts,
94
+ retrieve and apply catalogs, and store reports.
95
+
90
96
 
91
97
  USAGE NOTES
92
98
  -----------
93
- One need a /etc/puppetlabs/puppet/device.conf file with the following content:
99
+ Devices managed by the puppet-device subcommand on a Puppet agent are
100
+ configured in device.conf, which is located at $confdir/device.conf by default,
101
+ and is configurable with the $deviceconfig setting.
102
+
103
+ The device.conf file is an INI-like file, with one section per device:
94
104
 
95
- [remote.device.fqdn]
96
- type <type>
97
- url <url>
105
+ [<DEVICE_CERTNAME>]
106
+ type <TYPE>
107
+ url <URL>
108
+ debug
98
109
 
99
- where:
100
- * type: the current device type (the only value at this time is cisco)
101
- * url: an url allowing to connect to the device
110
+ The section name specifies the certname of the device.
102
111
 
103
- Supported url must conforms to:
104
- scheme://user:password@hostname/?query
112
+ The values for the type and url properties are specific to each type of device.
113
+
114
+ The optional debug property specifies transport-level debugging,
115
+ and is limited to telnet and ssh transports.
116
+
117
+ See https://docs.puppet.com/puppet/latest/config_file_device.html for details.
105
118
 
106
- with:
107
- * scheme: either ssh or telnet
108
- * user: username, can be omitted depending on the switch/router configuration
109
- * password: the connection password
110
- * query: this is device specific. Cisco devices supports an enable parameter whose
111
- value would be the enable password.
112
119
 
113
120
  OPTIONS
114
121
  -------
115
- Note that any setting that's valid in the configuration file
116
- is also a valid long argument. For example, 'server' is a valid configuration
117
- parameter, so you can specify '--server <servername>' as an argument.
122
+ Note that any setting that's valid in the configuration file is also a valid
123
+ long argument. For example, 'server' is a valid configuration parameter, so
124
+ you can specify '--server <servername>' as an argument.
118
125
 
119
126
  * --debug:
120
127
  Enable full debugging.
@@ -147,6 +154,10 @@ parameter, so you can specify '--server <servername>' as an argument.
147
154
  Target a specific device/certificate in the device.conf. Doing so will perform a
148
155
  device run against only that device/certificate.
149
156
 
157
+ * --user:
158
+ The user to run as. '--user=root' is required, even when run as root,
159
+ for runs that create device certificates or keys.
160
+
150
161
  * --verbose:
151
162
  Turn on verbose reporting.
152
163
 
@@ -155,8 +166,8 @@ parameter, so you can specify '--server <servername>' as an argument.
155
166
  and it is enabled by default, with a value of 120 (seconds). This causes
156
167
  +puppet agent+ to connect to the server every 2 minutes and ask it to sign a
157
168
  certificate request. This is useful for the initial setup of a puppet
158
- client. You can turn off waiting for certificates by specifying a time
159
- of 0.
169
+ client. You can turn off waiting for certificates by specifying a time of 0.
170
+
160
171
 
161
172
  EXAMPLE
162
173
  -------
@@ -48,10 +48,14 @@ class Puppet::Application::Doc < Puppet::Application
48
48
  options[:references] << arg.intern
49
49
  end
50
50
 
51
+ def summary
52
+ _("Generate Puppet references")
53
+ end
54
+
51
55
  def help
52
- <<-'HELP'
56
+ <<-HELP
53
57
 
54
- puppet-doc(8) -- Generate Puppet references
58
+ puppet-doc(8) -- #{summary}
55
59
  ========
56
60
 
57
61
  SYNOPSIS
@@ -12,10 +12,14 @@ class Puppet::Application::Filebucket < Puppet::Application
12
12
 
13
13
  attr :args
14
14
 
15
+ def summary
16
+ _("Store and retrieve files in a filebucket")
17
+ end
18
+
15
19
  def help
16
- <<-'HELP'
20
+ <<-HELP
17
21
 
18
- puppet-filebucket(8) -- Store and retrieve files in a filebucket
22
+ puppet-filebucket(8) -- #{summary}
19
23
  ========
20
24
 
21
25
  SYNOPSIS
@@ -95,10 +95,14 @@ class Puppet::Application::Lookup < Puppet::Application
95
95
  setup_terminuses
96
96
  end
97
97
 
98
+ def summary
99
+ _("Interactive Hiera lookup")
100
+ end
101
+
98
102
  def help
99
- <<-'HELP'
103
+ <<-HELP
100
104
 
101
- puppet-lookup(8) -- Interactive Hiera lookup
105
+ puppet-lookup(8) -- #{summary}
102
106
  ========
103
107
 
104
108
  SYNOPSIS
@@ -25,10 +25,14 @@ class Puppet::Application::Master < Puppet::Application
25
25
  exit 1
26
26
  end
27
27
 
28
+ def summary
29
+ _("The puppet master daemon")
30
+ end
31
+
28
32
  def help
29
- <<-'HELP'
33
+ <<-HELP
30
34
 
31
- puppet-master(8) -- The puppet master daemon
35
+ puppet-master(8) -- #{summary}
32
36
  ========
33
37
 
34
38
  SYNOPSIS
@@ -28,10 +28,14 @@ class Puppet::Application::Resource < Puppet::Application
28
28
  @extra_params << arg.to_sym
29
29
  end
30
30
 
31
+ def summary
32
+ _("The resource abstraction layer shell")
33
+ end
34
+
31
35
  def help
32
- <<-'HELP'
36
+ <<-HELP
33
37
 
34
- puppet-resource(8) -- The resource abstraction layer shell
38
+ puppet-resource(8) -- #{summary}
35
39
  ========
36
40
 
37
41
  SYNOPSIS
@@ -4,7 +4,7 @@ Puppet::Indirector::Face.define(:catalog, '0.0.1') do
4
4
  copyright "Puppet Inc.", 2011
5
5
  license "Apache 2 license; see COPYING"
6
6
 
7
- summary "Compile, save, view, and convert catalogs."
7
+ summary _("Compile, save, view, and convert catalogs.")
8
8
  description <<-'EOT'
9
9
  This subcommand deals with catalogs, which are compiled per-node artifacts
10
10
  generated from a set of Puppet manifests. By default, it interacts with the
@@ -4,7 +4,7 @@ Puppet::Indirector::Face.define(:certificate_request, '0.0.1') do
4
4
  copyright "Puppet Inc.", 2011
5
5
  license "Apache 2 license; see COPYING"
6
6
 
7
- summary "Manage certificate requests."
7
+ summary _("Manage certificate requests.")
8
8
  description <<-EOT
9
9
  This subcommand retrieves and submits certificate signing requests (CSRs).
10
10
  EOT
@@ -4,7 +4,7 @@ Puppet::Indirector::Face.define(:certificate_revocation_list, '0.0.1') do
4
4
  copyright "Puppet Inc.", 2011
5
5
  license "Apache 2 license; see COPYING"
6
6
 
7
- summary "Manage the list of revoked certificates."
7
+ summary _("Manage the list of revoked certificates.")
8
8
  description <<-EOT
9
9
  This subcommand is primarily for retrieving the certificate revocation
10
10
  list from the CA.
@@ -153,25 +153,29 @@ MSG
153
153
  result << [ "! #{appname}", _("! Subcommand unavailable due to error. Check error logs.") ]
154
154
  end
155
155
  else
156
- result << [appname, horribly_extract_summary_from(appname)]
156
+ begin
157
+ summary = Puppet::Application[appname].summary
158
+ if summary.empty?
159
+ summary = horribly_extract_summary_from(appname)
160
+ end
161
+ result << [appname, summary]
162
+ rescue StandardError, LoadError
163
+ result << ["! #{appname}", _("! Subcommand unavailable due to error. Check error logs.")]
164
+ end
157
165
  end
158
166
  end
159
167
  end
160
168
 
161
169
  def horribly_extract_summary_from(appname)
162
- begin
163
- help = Puppet::Application[appname].help.split("\n")
164
- # Now we find the line with our summary, extract it, and return it. This
165
- # depends on the implementation coincidence of how our pages are
166
- # formatted. If we can't match the pattern we expect we return the empty
167
- # string to ensure we don't blow up in the summary. --daniel 2011-04-11
168
- while line = help.shift do
169
- if md = /^puppet-#{appname}\([^\)]+\) -- (.*)$/.match(line) then
170
- return md[1]
171
- end
170
+ help = Puppet::Application[appname].help.split("\n")
171
+ # Now we find the line with our summary, extract it, and return it. This
172
+ # depends on the implementation coincidence of how our pages are
173
+ # formatted. If we can't match the pattern we expect we return the empty
174
+ # string to ensure we don't blow up in the summary. --daniel 2011-04-11
175
+ while line = help.shift do
176
+ if md = /^puppet-#{appname}\([^\)]+\) -- (.*)$/.match(line) then
177
+ return md[1]
172
178
  end
173
- rescue StandardError, LoadError
174
- return _("! Subcommand unavailable due to error. Check error logs.")
175
179
  end
176
180
  return ''
177
181
  end