Use new classes for run_command and Service

User and Group now return unmodified instance when they are called with
an instance of themselves: User(user) is user.

run_command() and Service class accept either names or User object.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Christian Heimes
2020-09-15 16:02:46 +02:00
committed by Rob Crittenden
parent 72fb4e60c8
commit b19d20e2db
4 changed files with 42 additions and 20 deletions

View File

@@ -36,6 +36,7 @@ from ipapython.dn import DN
from ipapython import kerberos
from ipalib import api, errors, x509
from ipaplatform import services
from ipaplatform.constants import User
from ipaplatform.paths import paths
from ipaserver.masters import (
CONFIGURED_SERVICE, ENABLED_SERVICE, HIDDEN_SERVICE, SERVICE_LIST
@@ -308,6 +309,8 @@ class Service:
self.keytab = keytab
self.cert = None
self.api = api
if service_user is not None:
service_user = User(service_user)
self.service_user = service_user
self.keytab_user = service_user
self.dm_password = None # silence pylint