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

Set default username to machine name

This commit is contained in:
Игорь Чудов 2019-11-18 18:08:09 +04:00
parent 692a1c8c55
commit 48d5e62598
Signed by untrusted user: nir
GPG Key ID: 0F3883600CAE7AAC

View File

@ -332,7 +332,8 @@ def parse_arguments():
arguments = argparse.ArgumentParser(description='Generate configuration out of parsed policies')
arguments.add_argument('user',
type=str,
help='SID to parse policies from')
default=get_machine_name(),
help='Domain username ({}) to parse policies for'.format(get_machine_name()))
arguments.add_argument('--dc',
type=str,
help='FQDN of the domain to replicate SYSVOL from')
@ -382,11 +383,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])
print('kinit succeed')