Hello community,

here is the log from the commit of package yast2-users for openSUSE:Factory 
checked in at 2018-03-11 18:01:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-users (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-users.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-users"

Sun Mar 11 18:01:49 2018 rev:208 rq:583764 version:4.0.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-users/yast2-users.changes  2018-03-04 
11:49:25.941015683 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-users.new/yast2-users.changes     
2018-03-11 18:01:52.162237347 +0100
@@ -1,0 +2,6 @@
+Thu Mar  1 09:36:25 UTC 2018 - mvid...@suse.com
+
+- Fixed removing the password expiration date (bsc#1080125)
+- 4.0.3
+
+-------------------------------------------------------------------

Old:
----
  yast2-users-4.0.2.tar.bz2

New:
----
  yast2-users-4.0.3.tar.bz2

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

Other differences:
------------------
++++++ yast2-users.spec ++++++
--- /var/tmp/diff_new_pack.QB9Lm6/_old  2018-03-11 18:01:53.134202502 +0100
+++ /var/tmp/diff_new_pack.QB9Lm6/_new  2018-03-11 18:01:53.142202215 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-users
-Version:        4.0.2
+Version:        4.0.3
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -87,10 +87,6 @@
 %dir %{yast_yncludedir}/users
 %dir %{yast_moduledir}/YaPI
 %{yast_clientdir}/*.rb
-%dir %{yast_libdir}/users
-%dir %{yast_libdir}/users/clients
-%{yast_libdir}/users/*
-%{yast_libdir}/users/clients/*
 %{yast_desktopdir}/*.desktop
 %{yast_moduledir}/*.pm
 %{yast_moduledir}/SSHAuthorizedKeys.rb

++++++ yast2-users-4.0.2.tar.bz2 -> yast2-users-4.0.3.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.0.2/.coveralls.yml 
new/yast2-users-4.0.3/.coveralls.yml
--- old/yast2-users-4.0.2/.coveralls.yml        1970-01-01 01:00:00.000000000 
+0100
+++ new/yast2-users-4.0.3/.coveralls.yml        2018-03-07 09:44:40.000000000 
+0100
@@ -0,0 +1 @@
+service_name: travis-ci
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.0.2/.travis.yml 
new/yast2-users-4.0.3/.travis.yml
--- old/yast2-users-4.0.2/.travis.yml   2018-02-27 14:54:29.000000000 +0100
+++ new/yast2-users-4.0.3/.travis.yml   2018-03-07 09:44:40.000000000 +0100
@@ -9,6 +9,7 @@
   - docker run --rm -it yast-users-image rpm -qa | sort
 
 script:
-  # the "yast-travis-ruby" script is included in the base yastdevel/ruby image
-  # see https://github.com/yast/docker-yast-ruby/blob/master/yast-travis-ruby
+  # the "yast-travis-cpp" script is included in the base yastdevel/cpp image
+  # see https://github.com/yast/docker-yast-ruby/blob/master/yast-travis-cpp
   - docker run -it -e TRAVIS=1 -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" 
yast-users-image yast-travis-cpp
+  - docker run -it -e TRAVIS=1 -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" -e COVERAGE=1 
-e CI=1 yast-users-image rake test:unit
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.0.2/.yardopts 
new/yast2-users-4.0.3/.yardopts
--- old/yast2-users-4.0.2/.yardopts     1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-users-4.0.3/.yardopts     2018-03-07 09:44:40.000000000 +0100
@@ -0,0 +1,6 @@
+--no-private
+--protected
+--markup markdown
+--output-dir doc/autodocs
+--readme README.md
+src/**/*.rb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.0.2/package/yast2-users.changes 
new/yast2-users-4.0.3/package/yast2-users.changes
--- old/yast2-users-4.0.2/package/yast2-users.changes   2018-02-27 
14:54:29.000000000 +0100
+++ new/yast2-users-4.0.3/package/yast2-users.changes   2018-03-07 
09:44:40.000000000 +0100
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Thu Mar  1 09:36:25 UTC 2018 - mvid...@suse.com
+
+- Fixed removing the password expiration date (bsc#1080125)
+- 4.0.3
+
+-------------------------------------------------------------------
 Tue Feb 27 13:49:22 UTC 2018 - jreidin...@suse.com
 
 - fix generating pot files (bsc#1083015)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.0.2/package/yast2-users.spec 
new/yast2-users-4.0.3/package/yast2-users.spec
--- old/yast2-users-4.0.2/package/yast2-users.spec      2018-02-27 
14:54:29.000000000 +0100
+++ new/yast2-users-4.0.3/package/yast2-users.spec      2018-03-07 
09:44:40.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-users
-Version:        4.0.2
+Version:        4.0.3
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -87,10 +87,6 @@
 %dir %{yast_yncludedir}/users
 %dir %{yast_moduledir}/YaPI
 %{yast_clientdir}/*.rb
-%dir %{yast_libdir}/users
-%dir %{yast_libdir}/users/clients
-%{yast_libdir}/users/*
-%{yast_libdir}/users/clients/*
 %{yast_desktopdir}/*.desktop
 %{yast_moduledir}/*.pm
 %{yast_moduledir}/SSHAuthorizedKeys.rb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.0.2/src/include/users/dialogs.rb 
new/yast2-users-4.0.3/src/include/users/dialogs.rb
--- old/yast2-users-4.0.2/src/include/users/dialogs.rb  2018-02-27 
14:54:29.000000000 +0100
+++ new/yast2-users-4.0.3/src/include/users/dialogs.rb  2018-03-07 
09:44:40.000000000 +0100
@@ -155,6 +155,145 @@
       ret == :ok ? pw : nil
     end
 
+
+    # helper function: show a popup if existing home directory should be used
+    # and its ownership should be changed
+    # @param dir [String]
+    # @param chown_default [Boolean]
+    def ask_chown_home(dir, chown_default)
+      UI.OpenDialog(
+        Opt(:decorated),
+        HBox(
+          HSpacing(1),
+          VBox(
+            VSpacing(0.2),
+            Label(
+              # popup label, %1 is path to directory
+              Builtins.sformat(_("The home directory (%1) already exists.\nUse 
it anyway?"), dir)
+            ),
+            Left(
+              # checkbox label
+              CheckBox(Id(:chown_home), _("&Change directory owner"), 
chown_default)
+            ),
+            ButtonBox(
+              PushButton(Id(:yes), Opt(:default), Label.YesButton),
+              PushButton(Id(:no), Label.NoButton)
+            ),
+            VSpacing(0.2)
+          ),
+          HSpacing(1)
+        )
+      )
+      answer = UI.UserInput == :yes
+      retmap = { "retval" => answer }
+      if answer
+        retmap["chown_home"] = UI.QueryWidget(Id(:chown_home), :Value)
+      end
+      UI.CloseDialog
+      retmap
+    end
+
+    # @param count [Integer] number of days after 1970-01-01
+    # @param date_format [String] strftime format like "%x" (localized date)
+    # @return [String]
+    def format_days_after_epoch(count, date_format)
+      `date --date='1970-01-01 00:00:01 #{count} days' +#{date_format}`.chomp
+    end
+
+    # generate contents for Password Settings Dialog
+    # @param user [Hash]
+    # @param exp_date [String] may be MODIFIED on return corresponding to the 
UI
+    # @return [Term] ui_term
+    def get_password_term(user, exp_date)
+      last_change = GetString(Ops.get(user, "shadowLastChange"), "0")
+      last_change_label = ""
+      expires = GetString(Ops.get(user, "shadowExpire"), "0")
+      expires = "0" if expires == ""
+
+      inact = GetInt(Ops.get(user, "shadowInactive"), -1)
+      max = GetInt(Ops.get(user, "shadowMax"), -1)
+      min = GetInt(Ops.get(user, "shadowMin"), -1)
+      warn = GetInt(Ops.get(user, "shadowWarning"), -1)
+
+      if last_change != "0"
+        last_change_label = format_days_after_epoch(last_change, "%x")
+      else
+        # label (date of last password change)
+        last_change_label = _("Never")
+      end
+      unless ["0", "-1", ""].include?(expires)
+        exp_date.replace(format_days_after_epoch(expires, "%Y-%m-%d"))
+      end
+      HBox(
+        HSpacing(3),
+        VBox(
+          VStretch(),
+          Left(Label("")),
+          HSquash(
+            VBox(
+              Left(
+                Label(
+                  # label
+                  Builtins.sformat(_("Last Password Change: %1"), 
last_change_label)
+                )
+              ),
+              VSpacing(0.2),
+              Left(
+                # check box label
+                CheckBox(Id(:force_pw), _("Force Password Change"), 
last_change == "0")
+              ),
+              VSpacing(1),
+              IntField(
+                Id("shadowWarning"),
+                # intfield label
+                _("Days &before Password Expiration to Issue Warning"),
+                -1,
+                99999,
+                warn
+              ),
+              VSpacing(0.5),
+              IntField(
+                Id("shadowInactive"),
+                # intfield label
+                _("Days after Password Expires with Usable &Login"),
+                -1,
+                99999,
+                inact
+              ),
+              VSpacing(0.5),
+              IntField(
+                Id("shadowMax"),
+                # intfield label
+                _("Ma&ximum Number of Days for the Same Password"),
+                -1,
+                99999,
+                max
+              ),
+              VSpacing(0.5),
+              IntField(
+                Id("shadowMin"),
+                # intfield label
+                _("&Minimum Number of Days for the Same Password"),
+                -1,
+                99999,
+                min
+              ),
+              VSpacing(0.5),
+              InputField(
+                Id("shadowExpire"),
+                Opt(:hstretch),
+                # textentry label
+                _("Ex&piration Date"),
+                exp_date
+              )
+            )
+          ),
+          VStretch()
+        ),
+        HSpacing(3)
+      )
+    end
+
     # Dialog for adding or editing a user.
     # @param [String] what "add_user" or "edit_user"
     # @return [Symbol] for wizard sequencer
@@ -192,7 +331,6 @@
       else
         cn = Ops.get_string(user, "cn", "")
       end
-      tmp_fullname = cn # for login proposing
       default_home = Users.GetDefaultHome(user_type)
       home = Ops.get_string(user, "homeDirectory", default_home)
       org_home = Ops.get_string(user, "org_homeDirectory", home)
@@ -201,7 +339,6 @@
         Ops.subtract(777, Builtins.tointeger(String.CutZeros(Users.GetUmask)))
       )
       mode = Ops.get_string(user, "home_mode", default_mode)
-      default_crypted_size = 100
       password = Ops.get_string(user, "userPassword")
       org_username = Ops.get_string(user, "org_uid", username)
       uid = GetInt(Ops.get(user, "uidNumber"), nil)
@@ -252,7 +389,6 @@
       groups = Ops.get_map(user, "grouplist", {})
 
       available_shells = Users.AllShells
-      grouplist = ""
       new_type = user_type
 
       all_groupnames = UsersCache.GetAllGroupnames
@@ -326,68 +462,6 @@
         nil
       end
 
-      # helper function: show a popup if existing crypted home directory file
-      # should be used by current user
-      ask_take_image = lambda do |img_file, key_file|
-        # yes/no popup label, %1,%2 are file paths
-        Popup.YesNo(
-          Builtins.sformat(
-            _(
-              "Crypted directory image and key files\n" +
-                "'%1' and '%2'\n" +
-                "were found. Use them for current user?\n" +
-                "\n" +
-                "This means that data from this image will be used instead of 
current home directory."
-            ),
-            img_file,
-            key_file
-          )
-        )
-      end
-
-      # helper function: show a popup if existing home directory should be used
-      # and its ownership should be changed
-      ask_chown_home = lambda do |dir, chown_default|
-        UI.OpenDialog(
-          Opt(:decorated),
-          HBox(
-            HSpacing(1),
-            VBox(
-              VSpacing(0.2),
-              # popup label, %1 is path to directory
-              Label(
-                Builtins.sformat(
-                  _("The home directory (%1) already exists.\nUse it anyway?"),
-                  dir
-                )
-              ),
-              Left(
-                # checkbox label
-                CheckBox(
-                  Id(:chown_home),
-                  _("&Change directory owner"),
-                  chown_default
-                )
-              ),
-              ButtonBox(
-                PushButton(Id(:yes), Opt(:default), Label.YesButton),
-                PushButton(Id(:no), Label.NoButton)
-              ),
-              VSpacing(0.2)
-            ),
-            HSpacing(1)
-          )
-        )
-        ui = UI.UserInput
-        retmap = { "retval" => ui == :yes }
-        if ui == :yes
-          Ops.set(retmap, "chown_home", UI.QueryWidget(Id(:chown_home), 
:Value))
-        end
-        UI.CloseDialog
-        deep_copy(retmap)
-      end
-
-
       # generate contents for User Data Dialog
       get_edit_term = lambda do
         # text entry
@@ -741,130 +815,6 @@
         )
       end
 
-      # generate contents for Password Settings Dialog
-      get_password_term = lambda do
-        last_change = GetString(Ops.get(user, "shadowLastChange"), "0")
-        last_change_label = ""
-        expires = GetString(Ops.get(user, "shadowExpire"), "0")
-        expires = "0" if expires == ""
-
-        inact = GetInt(Ops.get(user, "shadowInactive"), -1)
-        max = GetInt(Ops.get(user, "shadowMax"), -1)
-        min = GetInt(Ops.get(user, "shadowMin"), -1)
-        warn = GetInt(Ops.get(user, "shadowWarning"), -1)
-
-        if last_change != "0"
-          out = Convert.to_map(
-            SCR.Execute(
-              path(".target.bash_output"),
-              Builtins.sformat(
-                "date --date='1970-01-01 00:00:01 %1 days' +\"%%x\"",
-                last_change
-              )
-            )
-          )
-          # label (date of last password change)
-          last_change_label = Ops.get_locale(out, "stdout", _("Unknown"))
-        else
-          # label (date of last password change)
-          last_change_label = _("Never")
-        end
-        if expires != "0" && expires != "-1" && expires != ""
-          out = Convert.to_map(
-            SCR.Execute(
-              path(".target.bash_output"),
-              Ops.add(
-                Builtins.sformat(
-                  "date --date='1970-01-01 00:00:01 %1 days' ",
-                  expires
-                ),
-                "+\"%Y-%m-%d\""
-              )
-            )
-          )
-          # remove \n from the end
-          exp_date = Builtins.deletechars(
-            Ops.get_string(out, "stdout", ""),
-            "\n"
-          )
-        end
-        HBox(
-          HSpacing(3),
-          VBox(
-            VStretch(),
-            Left(Label("")),
-            HSquash(
-              VBox(
-                Left(
-                  Label(
-                    Builtins.sformat(
-                      # label
-                      _("Last Password Change: %1"),
-                      last_change_label
-                    )
-                  )
-                ),
-                VSpacing(0.2),
-                Left(
-                  # check box label
-                  CheckBox(
-                    Id(:force_pw),
-                    _("Force Password Change"),
-                    last_change == "0"
-                  )
-                ),
-                VSpacing(1),
-                IntField(
-                  Id("shadowWarning"),
-                  # intfield label
-                  _("Days &before Password Expiration to Issue Warning"),
-                  -1,
-                  99999,
-                  warn
-                ),
-                VSpacing(0.5),
-                IntField(
-                  Id("shadowInactive"),
-                  # intfield label
-                  _("Days after Password Expires with Usable &Login"),
-                  -1,
-                  99999,
-                  inact
-                ),
-                VSpacing(0.5),
-                IntField(
-                  Id("shadowMax"),
-                  # intfield label
-                  _("Ma&ximum Number of Days for the Same Password"),
-                  -1,
-                  99999,
-                  max
-                ),
-                VSpacing(0.5),
-                IntField(
-                  Id("shadowMin"),
-                  # intfield label
-                  _("&Minimum Number of Days for the Same Password"),
-                  -1,
-                  99999,
-                  min
-                ),
-                VSpacing(0.5),
-                InputField(
-                  Id("shadowExpire"),
-                  Opt(:hstretch),
-                  # textentry label
-                  _("Ex&piration Date"),
-                  exp_date
-                )
-              )
-            ),
-            VStretch()
-          ),
-          HSpacing(3)
-        )
-      end
-
       # generate contents for Plugins Dialog
       get_plugins_term = lambda do
         plugin_client = Ops.get(clients, 0, "")
@@ -1290,7 +1240,7 @@
               if error_map != {}
                 if Ops.get_string(error_map, "question_id", "") == "chown" &&
                     !Builtins.haskey(error_map, "owned")
-                  ret2 = ask_chown_home.call(home, chown_home)
+                  ret2 = ask_chown_home(home, chown_home)
                   if Ops.get_boolean(ret2, "retval", false)
                     Ops.set(ui_map, "chown", home)
                     chown_home = Ops.get_boolean(ret2, "chown_home", 
chown_home)
@@ -1484,7 +1434,7 @@
               if error_map != {}
                 if Ops.get_string(error_map, "question_id", "") == "chown" &&
                     !Builtins.haskey(error_map, "owned")
-                  ret2 = ask_chown_home.call(new_home, chown_home)
+                  ret2 = ask_chown_home(new_home, chown_home)
                   if Ops.get_boolean(ret2, "retval", false)
                     Ops.set(ui_map, "chown", new_home)
                     chown_home = Ops.get_boolean(ret2, "chown_home", 
chown_home)
@@ -1616,7 +1566,7 @@
           if new_exp_date != exp_date
             exp_date = new_exp_date
             if exp_date == ""
-              Ops.set(user, "shadowExpire", user_type == "ldap" ? "" : "0")
+              user["shadowExpire"] = ""
             else
               out = Convert.to_map(
                 SCR.Execute(
@@ -1819,7 +1769,8 @@
           current = ret
         end
         if ret == :passwordsettings
-          UI.ReplaceWidget(:tabContents, get_password_term.call)
+          # get_password_term may modify exp_date!
+          UI.ReplaceWidget(:tabContents, get_password_term(user, exp_date))
           if GetString(Ops.get(user, "shadowLastChange"), "0") == "0"
             # forcing password change cannot be undone
             UI.ChangeWidget(Id(:force_pw), :Enabled, false)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.0.2/test/Makefile.am 
new/yast2-users-4.0.3/test/Makefile.am
--- old/yast2-users-4.0.2/test/Makefile.am      2018-02-27 14:54:29.000000000 
+0100
+++ new/yast2-users-4.0.3/test/Makefile.am      2018-03-07 09:44:40.000000000 
+0100
@@ -1,10 +1,13 @@
 # Tests for users
 TESTS = \
-  users_finish_test.rb \
   lib/users/ca_password_validator_test.rb \
   lib/users/encryption_method_test.rb \
   lib/users/ssh_authorized_keys_file_test.rb \
   lib/users/users_database_test.rb \
+  dialogs_test.rb \
+  ssh_authorized_keys_test.rb \
+  users_auto_test.rb \
+  users_finish_test.rb \
   widgets_test.rb
 
 TEST_EXTENSIONS = .rb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.0.2/test/dialogs_test.rb 
new/yast2-users-4.0.3/test/dialogs_test.rb
--- old/yast2-users-4.0.2/test/dialogs_test.rb  1970-01-01 01:00:00.000000000 
+0100
+++ new/yast2-users-4.0.3/test/dialogs_test.rb  2018-03-07 09:44:40.000000000 
+0100
@@ -0,0 +1,49 @@
+require_relative "./test_helper"
+Yast.import "UI"
+
+class UsersDialogsDummy < Yast::Module
+  def initialize
+    Yast.include self, "users/dialogs.rb"
+  end
+end
+
+describe "Yast::UsersDialogsInclude" do
+  subject { UsersDialogsDummy.new }
+
+  before do
+    allow(Yast).to receive(:import).and_call_original
+    allow(Yast).to receive(:import).with("Ldap")
+    allow(Yast).to receive(:import).with("LdapPopup")
+  end
+
+  describe "#ask_chown_home" do
+    before(:each) do
+      expect(Yast::UI).to receive(:OpenDialog)
+      expect(Yast::UI).to receive(:CloseDialog)
+    end
+
+    it "returns a two-key result when Yes is answered" do
+      expect(Yast::UI).to receive(:UserInput).and_return :yes
+      expect(Yast::UI).to receive(:QueryWidget)
+                            .with(Id(:chown_home), :Value).and_return(false)
+
+      expect(subject.ask_chown_home("/home/foo", true))
+        .to eq({"retval" => true, "chown_home" => false})
+    end
+    it "returns a one result when No is answered" do
+      expect(Yast::UI).to receive(:UserInput).and_return :no
+      expect(subject.ask_chown_home("/home/foo", true))
+        .to eq({"retval" => false})
+    end
+  end
+
+  describe "#get_password_term" do
+    it "sets exp_date" do
+      user = { "shadowExpire" => 30 } # days after 1970-01-01
+      exp_date = ""
+
+      subject.get_password_term(user, exp_date)
+      expect(exp_date).to eq("1970-01-31")
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.0.2/test/users_auto_test.rb 
new/yast2-users-4.0.3/test/users_auto_test.rb
--- old/yast2-users-4.0.2/test/users_auto_test.rb       2018-02-27 
14:54:29.000000000 +0100
+++ new/yast2-users-4.0.3/test/users_auto_test.rb       2018-03-07 
09:44:40.000000000 +0100
@@ -2,18 +2,25 @@
 
 require_relative "test_helper"
 require "yaml"
-require_relative "../src/clients/users_auto"
 
-describe Yast::UsersAutoClient do
+describe "Yast::UsersAutoClient" do
   Yast.import "WFM"
   Yast.import "Users"
   Yast.import "Users"
   Yast.import "Report"
 
+  subject { Yast::UsersAutoClient.new }
   let(:mode) { "autoinstallation" }
 
   before do
+    allow(Yast).to receive(:import).and_call_original
+    allow(Yast).to receive(:import).with("Ldap")
+    allow(Yast).to receive(:import).with("LdapPopup")
+
     allow(Yast::Mode).to receive(:mode).and_return(mode)
+
+    # this actually executes the client 8-O
+    require_relative "../src/clients/users_auto"
   end
 
   describe "#AutoYaST" do


Reply via email to