Hello community,

here is the log from the commit of package yast2-ntp-client for 
openSUSE:Factory checked in at 2017-07-10 11:00:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-ntp-client (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-ntp-client.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-ntp-client"

Mon Jul 10 11:00:23 2017 rev:96 rq:507753 version:3.3.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-ntp-client/yast2-ntp-client.changes        
2017-07-02 13:32:46.708747391 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-ntp-client.new/yast2-ntp-client.changes   
2017-07-10 11:00:24.355426690 +0200
@@ -1,0 +2,32 @@
+Fri Jun 30 16:58:16 UTC 2017 - knut.anders...@suse.com
+
+- Resrict records are written at the end but the default file and
+  most profiles use them at the beginning, which mangles the file
+  completely (bsc#983486).
+  To fix it we have just changed the order of writing.
+- 3.3.1
+
+-------------------------------------------------------------------
+Fri Jun 30 09:36:48 UTC 2017 - jlo...@suse.com
+
+- AutoYaST: Fix crash when trying to sanitize not string values,
+  for example initial_sync.
+- AutoYaST: Sanitize comments by only removing blank spaces at
+  the beginning and adding line break. This avoids augeas parse
+  errors (bsc#1045777).
+
+-------------------------------------------------------------------
+Thu Jun 30 09:32:02 UTC 2017 - knut.anders...@suse.com
+
+- AutoYaST: Fix crash in CFA when creating a command record with
+  some key value option is given (bsc#1045968)
+
+-------------------------------------------------------------------
+Thu Jun 29 15:19:51 UTC 2017 - jlo...@suse.com
+
+- AutoYaST: Comments from autoyast profile should not be sanitized
+  to avoid entries without space between value and comment (e.g
+  trustedkey 1# coment). This is caused by a bug in augeas adding
+  new entries.
+
+-------------------------------------------------------------------

Old:
----
  yast2-ntp-client-3.3.0.tar.bz2

New:
----
  yast2-ntp-client-3.3.1.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-ntp-client.spec ++++++
--- /var/tmp/diff_new_pack.Ro8Q2u/_old  2017-07-10 11:00:25.451271925 +0200
+++ /var/tmp/diff_new_pack.Ro8Q2u/_new  2017-07-10 11:00:25.455271360 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-ntp-client
-Version:        3.3.0
+Version:        3.3.1
 Release:        0
 Summary:        YaST2 - NTP Client Configuration
 License:        GPL-2.0+

++++++ yast2-ntp-client-3.3.0.tar.bz2 -> yast2-ntp-client-3.3.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ntp-client-3.3.0/.yardopts 
new/yast2-ntp-client-3.3.1/.yardopts
--- old/yast2-ntp-client-3.3.0/.yardopts        1970-01-01 01:00:00.000000000 
+0100
+++ new/yast2-ntp-client-3.3.1/.yardopts        2017-07-03 11:25:34.931339056 
+0200
@@ -0,0 +1,7 @@
+--no-private
+--markup markdown
+--protected
+--readme README.md
+--output-dir ./doc/autodocs
+--files *.md
+src/**/*.rb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-ntp-client-3.3.0/package/yast2-ntp-client.changes 
new/yast2-ntp-client-3.3.1/package/yast2-ntp-client.changes
--- old/yast2-ntp-client-3.3.0/package/yast2-ntp-client.changes 2017-06-29 
12:41:52.639939132 +0200
+++ new/yast2-ntp-client-3.3.1/package/yast2-ntp-client.changes 2017-07-03 
11:25:34.931339056 +0200
@@ -1,4 +1,36 @@
 -------------------------------------------------------------------
+Fri Jun 30 16:58:16 UTC 2017 - knut.anders...@suse.com
+
+- Resrict records are written at the end but the default file and
+  most profiles use them at the beginning, which mangles the file
+  completely (bsc#983486).
+  To fix it we have just changed the order of writing.
+- 3.3.1
+
+-------------------------------------------------------------------
+Fri Jun 30 09:36:48 UTC 2017 - jlo...@suse.com
+
+- AutoYaST: Fix crash when trying to sanitize not string values,
+  for example initial_sync.
+- AutoYaST: Sanitize comments by only removing blank spaces at
+  the beginning and adding line break. This avoids augeas parse
+  errors (bsc#1045777).
+
+-------------------------------------------------------------------
+Thu Jun 30 09:32:02 UTC 2017 - knut.anders...@suse.com
+
+- AutoYaST: Fix crash in CFA when creating a command record with
+  some key value option is given (bsc#1045968)
+
+-------------------------------------------------------------------
+Thu Jun 29 15:19:51 UTC 2017 - jlo...@suse.com
+
+- AutoYaST: Comments from autoyast profile should not be sanitized
+  to avoid entries without space between value and comment (e.g
+  trustedkey 1# coment). This is caused by a bug in augeas adding
+  new entries.
+
+-------------------------------------------------------------------
 Mon Jun 26 17:23:52 UTC 2017 - jlo...@suse.com
 
 - AutoYaST: Fixed crash in CFA when creating restrict record from
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ntp-client-3.3.0/package/yast2-ntp-client.spec 
new/yast2-ntp-client-3.3.1/package/yast2-ntp-client.spec
--- old/yast2-ntp-client-3.3.0/package/yast2-ntp-client.spec    2017-06-29 
12:41:52.639939132 +0200
+++ new/yast2-ntp-client-3.3.1/package/yast2-ntp-client.spec    2017-07-03 
11:25:34.931339056 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-ntp-client
-Version:        3.3.0
+Version:        3.3.1
 Release:        0
 Summary:        YaST2 - NTP Client Configuration
 License:        GPL-2.0+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ntp-client-3.3.0/src/lib/cfa/ntp_conf.rb 
new/yast2-ntp-client-3.3.1/src/lib/cfa/ntp_conf.rb
--- old/yast2-ntp-client-3.3.0/src/lib/cfa/ntp_conf.rb  2017-06-29 
12:41:52.643939132 +0200
+++ new/yast2-ntp-client-3.3.1/src/lib/cfa/ntp_conf.rb  2017-07-03 
11:25:34.935339056 +0200
@@ -49,6 +49,16 @@
 
     COLLECTION_KEYS = (RECORD_ENTRIES + ["action"]).freeze
 
+    KEY_VALUE_CMD_OPTIONS = %w(
+      ident
+      key
+      minpoll
+      maxpoll
+      mode
+      ttl
+      version
+    ).freeze
+
     def initialize(file_handler: nil)
       super(PARSER, PATH, file_handler: file_handler)
     end
@@ -346,13 +356,30 @@
     class CommandRecord < Record
       def options
         return [] unless tree_value?
-        augeas_options.map { |option| option[:key] }
+        augeas_options.each_with_object({}) do |option, opts|
+          opts[option[:key]] = option[:value]
+        end.to_a.flatten.compact
       end
 
       def options=(options)
         ensure_tree_value
         tree_value.tree.delete(options_matcher)
-        options.each { |option| tree_value.tree.add(option, nil) }
+
+        i = 0
+
+        while i < options.size
+          if KEY_VALUE_CMD_OPTIONS.include?(options[i])
+            add_option(options[i], options[i + 1])
+            i += 2
+          else
+            add_option(options[i], nil)
+            i += 1
+          end
+        end
+      end
+
+      def add_option(key, option)
+        tree_value.tree.add(key, option)
       end
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ntp-client-3.3.0/src/modules/NtpClient.rb 
new/yast2-ntp-client-3.3.1/src/modules/NtpClient.rb
--- old/yast2-ntp-client-3.3.0/src/modules/NtpClient.rb 2017-06-29 
12:41:52.647939132 +0200
+++ new/yast2-ntp-client-3.3.1/src/modules/NtpClient.rb 2017-07-03 
11:25:34.935339056 +0200
@@ -617,7 +617,9 @@
       # write settings
       return false if !go_next
 
-      @ntp_records += restrict_map_records
+      # Restrict map records are written first to not mangle the config file
+      # (bsc#983486)
+      @ntp_records = restrict_map_records + @ntp_records
 
       log.info "Writing settings #{@ntp_records}"
 
@@ -988,9 +990,19 @@
   private
 
     # Remove blank spaces in values
+    #
+    # @note to avoid augeas parsing errors, comments should be sanitized by
+    #   removing blank spaces at the beginning and adding line break.
     def sanitize_record(record)
       sanitized = record.dup
-      sanitized.each_value(&:strip!)
+      sanitized.each do |key, value|
+        if key.include?("comment")
+          value.sub!(/^ */, "")
+          value << "\n" unless value.include?("\n")
+        elsif value.respond_to?(:strip!)
+          value.strip!
+        end
+      end
       sanitized
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ntp-client-3.3.0/test/cfa/ntp_conf_test.rb 
new/yast2-ntp-client-3.3.1/test/cfa/ntp_conf_test.rb
--- old/yast2-ntp-client-3.3.0/test/cfa/ntp_conf_test.rb        2017-06-29 
12:41:52.647939132 +0200
+++ new/yast2-ntp-client-3.3.1/test/cfa/ntp_conf_test.rb        2017-07-03 
11:25:34.935339056 +0200
@@ -318,10 +318,10 @@
 
   describe "#options=" do
     it "sets options to the record" do
-      record.options = ["iburst", "prefer"]
-      expect(record.options).to eq(["iburst", "prefer"])
+      record.options = ["iburst", "version", "3", "prefer"]
+      expect(record.options).to eq(["iburst", "version", "3", "prefer"])
       ntp.save
-      expect(file.content).to include("server 0.pool.ntp.org iburst prefer\n")
+      expect(file.content).to include("server 0.pool.ntp.org iburst version 3 
prefer\n")
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-ntp-client-3.3.0/test/fixtures/autoyast/autoinst.xml 
new/yast2-ntp-client-3.3.1/test/fixtures/autoyast/autoinst.xml
--- old/yast2-ntp-client-3.3.0/test/fixtures/autoyast/autoinst.xml      
2017-06-29 12:41:52.647939132 +0200
+++ new/yast2-ntp-client-3.3.1/test/fixtures/autoyast/autoinst.xml      
2017-07-03 11:25:34.939339056 +0200
@@ -5,8 +5,9 @@
     <ntp_policy>STATIC</ntp_policy>
     <peers config:type="list">
       <peer>
-        <address>0.opensuse.pool.ntp.org</address>
-        <comment/>
+        <address> 0.opensuse.pool.ntp.org </address>
+        <comment> # a comment with spaces </comment>
+        <initial_sync config:type="boolean">true</initial_sync>
         <options>iburst</options>
         <type>server</type>
       </peer>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ntp-client-3.3.0/test/ntp_client_test.rb 
new/yast2-ntp-client-3.3.1/test/ntp_client_test.rb
--- old/yast2-ntp-client-3.3.0/test/ntp_client_test.rb  2017-06-29 
12:41:52.647939132 +0200
+++ new/yast2-ntp-client-3.3.1/test/ntp_client_test.rb  2017-07-03 
11:25:34.939339056 +0200
@@ -49,6 +49,16 @@
           subject.Import(ntp_client_section)
         end
 
+        it "sanitizes values" do
+          record = subject.ntp_records.first
+          expect(record["address"]).to eq "0.opensuse.pool.ntp.org"
+        end
+
+        it "sanitizes comments by removing blank spaces at the beginning and 
adding line break" do
+          record = subject.ntp_records.first
+          expect(record["comment"]).to eq "# a comment with spaces \n"
+        end
+
         it "reads the list of peers" do
           expect(subject.ntp_records.size).to eq 4
         end


Reply via email to