1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-21 18:50:38 +03:00

Fix refactored code for absent and renamed functions

This commit is contained in:
Evgeny Sinelnikov 2019-11-27 20:22:37 +04:00
parent 1d59bb02de
commit 78be6dd627
2 changed files with 12 additions and 4 deletions

View File

@ -58,8 +58,8 @@ def parse_arguments():
arguments.add_argument('user',
type=str,
nargs='?',
default=get_machine_name(),
help='Domain username ({}) to parse policies for'.format(get_machine_name()))
default=util.get_machine_name(),
help='Domain username ({}) to parse policies for'.format(util.get_machine_name()))
arguments.add_argument('--dc',
type=str,
help='FQDN of the domain to replicate SYSVOL from')
@ -68,7 +68,7 @@ def parse_arguments():
help='Operate without domain (apply local policy)')
return arguments.parse_args()
def apply_samba_dc(arg_dc, arg_user):
def apply_samba_domain(arg_dc, arg_user):
sambaopts = options.SambaOptions(parser)
credopts = options.CredentialsOptions(parser)
# Initialize loadparm context
@ -117,6 +117,7 @@ def apply_local_policy(user):
appl.apply_parameters()
def main():
global parser
parser = optparse.OptionParser('GPO Applier')
args = parse_arguments()

View File

@ -2,6 +2,7 @@ import logging
import subprocess
import socket
import sys
import os
import pickle
from samba.gpclass import get_dc_hostname
@ -58,11 +59,17 @@ def wbinfo_getsid(domain, user):
return sid
def get_machine_name():
'''
Get localhost name looking like DC0$
'''
return socket.gethostname().split('.', 1)[0].upper() + "$"
def machine_kinit():
'''
Perform kinit with machine credentials
'''
host = socket.gethostname().split('.', 1)[0].upper() + "$"
host = get_machine_name()
subprocess.call(['kinit', '-k', host])
logging.debug('kinit succeed')