Commit b2b6f958 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Fix system account creation for OS such as Mandriva 2010 where --system'' is not supported.

parent e020a719
......@@ -472,7 +472,7 @@ class User(object):
try:
pwd.getpwnam(self.name)
except KeyError:
user_parameter_list.append('--system')
user_parameter_list.append('-r')
callAndRead(['useradd'] + user_parameter_list)
else:
callAndRead(['usermod'] + user_parameter_list)
......
......@@ -225,7 +225,7 @@ class TestComputer(SlapformatMixin):
self.assertEqual([
'ip addr list bridge',
'groupadd slapsoft',
'useradd -d /software_root -g slapsoft -s /bin/false slapsoft --system'
'useradd -d /software_root -g slapsoft -s /bin/false slapsoft -r'
],
self.fakeCallAndRead.external_command_list)
......@@ -259,7 +259,7 @@ class TestComputer(SlapformatMixin):
self.assertEqual([
'ip addr list bridge',
'groupadd slapsoft',
'useradd -d /software_root -g slapsoft -s /bin/false slapsoft --system'
'useradd -d /software_root -g slapsoft -s /bin/false slapsoft -r'
],
self.fakeCallAndRead.external_command_list)
......@@ -309,9 +309,9 @@ class TestComputer(SlapformatMixin):
self.assertEqual([
'ip addr list bridge',
'groupadd slapsoft',
'useradd -d /software_root -g slapsoft -s /bin/false slapsoft --system',
'useradd -d /software_root -g slapsoft -s /bin/false slapsoft -r',
'groupadd testuser',
'useradd -d /instance_root/partition -g testuser -s /bin/false -G slapsoft testuser --system',
'useradd -d /instance_root/partition -g testuser -s /bin/false -G slapsoft testuser -r',
'tunctl -t tap -u testuser',
'ip link set tap up',
'brctl show',
......@@ -391,9 +391,9 @@ class TestComputer(SlapformatMixin):
self.assertEqual([
# 'ip addr list bridge',
'groupadd slapsoft',
'useradd -d /software_root -g slapsoft -s /bin/false slapsoft --system',
'useradd -d /software_root -g slapsoft -s /bin/false slapsoft -r',
'groupadd testuser',
'useradd -d /instance_root/partition -g testuser -s /bin/false -G slapsoft testuser --system',
'useradd -d /instance_root/partition -g testuser -s /bin/false -G slapsoft testuser -r',
# 'ip addr add ip/255.255.255.255 dev bridge',
# 'ip addr list bridge',
# 'ip addr add ip/ffff:ffff:ffff:ffff:: dev bridge',
......@@ -469,7 +469,7 @@ class TestUser(SlapformatMixin):
self.assertEqual([
'groupadd doesnotexistsyet',
'useradd -d /doesnotexistsyet -g doesnotexistsyet -s /bin/false '\
'doesnotexistsyet --system'
'doesnotexistsyet -r'
],
self.fakeCallAndRead.external_command_list)
......@@ -482,7 +482,7 @@ class TestUser(SlapformatMixin):
self.assertEqual([
'groupadd doesnotexistsyet',
'useradd -d /doesnotexistsyet -g doesnotexistsyet -s /bin/false -G '\
'additionalgroup1,additionalgroup2 doesnotexistsyet --system'
'additionalgroup1,additionalgroup2 doesnotexistsyet -r'
],
self.fakeCallAndRead.external_command_list)
......@@ -494,7 +494,7 @@ class TestUser(SlapformatMixin):
user.create()
self.assertEqual([
'useradd -d /testuser -g testuser -s /bin/false testuser --system'
'useradd -d /testuser -g testuser -s /bin/false testuser -r'
],
self.fakeCallAndRead.external_command_list)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment