Skip to content

Commit

Permalink
Merge pull request #89 from imobach/fix-users-import
Browse files Browse the repository at this point in the history
Fix users import
  • Loading branch information
imobachgs committed Mar 14, 2016
2 parents 88c49c9 + c9d98b1 commit 21ef740
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
7 changes: 7 additions & 0 deletions package/yast2-users.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Sat Mar 5 11:04:17 UTC 2016 - igonzalezsosa@suse.com

- Do not include inst-sys users when cloning the configuration
after the installation (bnc#965852)
- 3.1.41.2

-------------------------------------------------------------------
Thu Feb 18 14:00:19 CET 2016 - schubi@suse.de

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-users.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-users
Version: 3.1.41.1
Version: 3.1.41.2
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
15 changes: 9 additions & 6 deletions src/modules/Users.pm
Expand Up @@ -5885,8 +5885,9 @@ sub ImportUser {
}
}

if ($uid == -1) {
# check for existence of this user (and change it with given values)
if ($uid == -1 || Stage->initial()) {
# Check for existence of this user (and change it with given values).
# During 1st stage we simply match by username (bnc#965852).
my %existing = %{$self->GetUserByName ($username, "")};
if (%existing) {

Expand All @@ -5910,7 +5911,7 @@ sub ImportUser {
$cn eq "") {
$cn = $existing{"cn"} || "";
}
if ($gid == -1) {
if ($gid == -1 || Stage->initial()) {
$gid = $existing{"gidNumber"};
}
%ret = (
Expand Down Expand Up @@ -6000,8 +6001,9 @@ sub ImportGroup {
$gid = $group{"gid"} if (!defined $gid);
$gid = -1 if (!defined $gid);
}
if ($gid == -1) {
# check for existence of this group (and change it with given values)
if ($gid == -1 || Stage->initial()) {
# Check for existence of this group (and change it with given values).
# During 1st stage we simply match by groupname (bnc#965852).
my $existing = $self->GetGroupByName ($groupname, "");
if (ref ($existing) eq "HASH" && %{$existing}) {
$gid = $existing->{"gidNumber"};
Expand Down Expand Up @@ -6154,7 +6156,8 @@ sub Import {
# remove cache entries (#50265)
UsersCache->ResetCache ();

my $error_msg = Mode->test () ? "" : $self->ReadLocal ();
# Avoid to read local users during 1st stage (bnc#965852)
my $error_msg = (Mode->test() || Stage->initial()) ? "" : $self->ReadLocal ();
if ($error_msg) {
return 0;
}
Expand Down

0 comments on commit 21ef740

Please sign in to comment.