Compare commits
No commits in common. "7ddc8cc12fee3f74d5837c39f0749a2205042f2b" and "673449026e89d257a03791a9b1660f6e693ee966" have entirely different histories.
7ddc8cc12f
...
673449026e
2 changed files with 670 additions and 658 deletions
1317
inventory.yml
1317
inventory.yml
File diff suppressed because it is too large
Load diff
|
|
@ -4,7 +4,6 @@ import argparse
|
|||
import struct
|
||||
import subprocess
|
||||
import json
|
||||
import sys
|
||||
|
||||
from os import environ,path
|
||||
from impacket.krb5.ccache import CCache
|
||||
|
|
@ -26,7 +25,7 @@ def get_printers():
|
|||
printers.append(printer)
|
||||
return printers
|
||||
except subprocess.CalledProcessError as e:
|
||||
sys.stderr.write(f"Fehler beim Abrufen der Drucker: {e}")
|
||||
print(f"Fehler beim Abrufen der Drucker: {e}")
|
||||
return []
|
||||
|
||||
def get_groups(username):
|
||||
|
|
@ -35,7 +34,7 @@ def get_groups(username):
|
|||
groups = result.stdout.strip().split('\0')
|
||||
return groups
|
||||
except subprocess.CalledProcessError as e:
|
||||
sys.stderr.write(f"Fehler beim Abrufen der Gruppen: {e}")
|
||||
print(f"Fehler beim Abrufen der Gruppen: {e}")
|
||||
return []
|
||||
|
||||
def get_krb5 ():
|
||||
|
|
@ -51,7 +50,7 @@ def get_krb5 ():
|
|||
krb5['endtime'] = ccache.credentials[0]['time']['endtime']
|
||||
krb5['renew_till'] = ccache.credentials[0]['time']['renew_till']
|
||||
except:
|
||||
sys.stderr.write("Fehler beim Ticket laden")
|
||||
print("Fehler beim Ticket laden")
|
||||
return krb5
|
||||
|
||||
def get_mounts():
|
||||
|
|
@ -97,7 +96,7 @@ def main():
|
|||
nethome = f"/srv/samba/schools/default-school/teachers/{vminfo['User']}"
|
||||
else:
|
||||
result = subprocess.run(['find', '/srv/samba/schools/default-school/students/', '-name', vminfo['User'], '-maxdepth', '2', '-type', 'd'], capture_output=True, text=True, check=False)
|
||||
nethome = result.stdout.splitlines()[0]
|
||||
nethome = result.stdout
|
||||
|
||||
vminfo['Printers'] = get_printers()
|
||||
vminfo['krb5'] = get_krb5()
|
||||
|
|
@ -106,7 +105,7 @@ def main():
|
|||
vminfo['QuickAccess'] = get_quickaccess()
|
||||
|
||||
vminfo_json = json.dumps(vminfo, ensure_ascii=False, indent=4)
|
||||
print(vminfo_json)
|
||||
print(vminfo_json)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue