Showing with 25 additions and 14 deletions.
  1. +5 −0 CHANGELOG.md
  2. +4 −3 lib/puppet/provider/augeas/augeas.rb
  3. +5 −10 locales/puppetlabs-augeas_core.pot
  4. +1 −1 metadata.json
  5. +10 −0 spec/unit/provider/augeas/augeas_spec.rb
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## [1.0.2] - 2018-09-25
### Changed
- (MODULES-7814) Ignore nil values when parsing commands

## [1.0.1] - 2018-08-15
### Added
- (MODULE-7443) Safely deserialize stringified array
Expand All @@ -18,5 +22,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
### Summary
This is the initial release of the extracted augeas module

[1.0.2]: https://github.com/puppetlabs/puppetlabs-augeas_core/compare/1.0.1...1.0.2
[1.0.1]: https://github.com/puppetlabs/puppetlabs-augeas_core/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/puppetlabs/puppetlabs-augeas_core/releases/tag/1.0.0
7 changes: 4 additions & 3 deletions lib/puppet/provider/augeas/augeas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ def parse_commands(data)
data = data.flatten
args = []
data.each do |line|
next if line.nil?
line.strip!
next if line.nil? || line.empty?
next if line.empty?
argline = []
sc = StringScanner.new(line)
cmd = sc.scan(%r{\w+|==|!=})
Expand Down Expand Up @@ -442,7 +443,7 @@ def need_to_run?
save_result = @aug.save
unless save_result
print_put_errors
fail(_('Saving failed, see debug'))
fail(_('Save failed, see debug output for details'))
end

saved_files = @aug.match('/augeas/events/saved')
Expand Down Expand Up @@ -484,7 +485,7 @@ def execute_changes
do_execute_changes
unless @aug.save
print_put_errors
fail(_('Save failed, see debug'))
fail(_('Save failed, see debug output for details'))
end

:executed
Expand Down
15 changes: 5 additions & 10 deletions locales/puppetlabs-augeas_core.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: puppetlabs-augeas_core 1.0.0-11-g6df0e15\n"
"\n"
"Project-Id-Version: puppetlabs-augeas_core \n"
"Report-Msgid-Bugs-To: docs@puppet.com\n"
"POT-Creation-Date: 2018-08-16 08:55-0700\n"
"PO-Revision-Date: 2018-08-16 08:55-0700\n"
"POT-Creation-Date: 2018-09-20 19:58+0000\n"
"PO-Revision-Date: 2018-09-20 19:58+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
Expand Down Expand Up @@ -63,12 +62,8 @@ msgstr ""
msgid "Error sending command '%{command}' with params %{param}/%{message}"
msgstr ""

#: ../lib/puppet/provider/augeas/augeas.rb:445
msgid "Saving failed, see debug"
msgstr ""

#: ../lib/puppet/provider/augeas/augeas.rb:487
msgid "Save failed, see debug"
#: ../lib/puppet/provider/augeas/augeas.rb:445 ../lib/puppet/provider/augeas/augeas.rb:487
msgid "Save failed, see debug output for details"
msgstr ""

#: ../lib/puppet/provider/augeas/augeas.rb:500
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-augeas_core",
"version": "1.0.1",
"version": "1.0.2",
"author": "Puppet Labs",
"summary": "Manage files using Augeas",
"license": "Apache-2.0",
Expand Down
10 changes: 10 additions & 0 deletions spec/unit/provider/augeas/augeas_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ def make_tmpname((prefix, suffix), n)
end

describe 'command parsing' do
it 'ignores nil values when parsing commands' do
commands = [nil, 'set Jar/Jar Binks']
tokens = provider.parse_commands(commands)
expect(tokens.size).to eq(1)
expect(tokens[0].size).to eq(3)
expect(tokens[0][0]).to eq('set')
expect(tokens[0][1]).to eq('Jar/Jar')
expect(tokens[0][2]).to eq('Binks')
end

it 'breaks apart a single line into three tokens and clean up the context' do
resource[:context] = '/context'
tokens = provider.parse_commands('set Jar/Jar Binks')
Expand Down