Commit 1eaf1523 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Version 2011-05-31 17:06

M  src/
A  src/hostinfo/
parent b72a45cc
import copy
import hostinfo.automount
import hostinfo.dhcpd
import hostinfo.ifconfig
import hostinfo.macosx_auto
......@@ -208,6 +209,12 @@ if __name__ == '__main__':
help="The host to generate information for")
action="store", metavar="DIR",
help="generate automount maps in DIR")
action="store", metavar="DOMAIN",
help="DOMAIN name for automount maps")
action="store", metavar="DIR",
help="generate DIR/*/(dfslink|autolink)")
......@@ -266,6 +273,10 @@ if __name__ == '__main__':
for (f, c) in hostinfo.samba.msdfs(tree):
symlink["%s/%s" % (options.dfs, f)] = c
if options.automount:
for (f, c) in hostinfo.automount.generate(tree,options.auto_domain):
file["%s/%s" % (options.automount, f)] = c
if options.dhcpd:
name = "%s/dhcpd.conf" % options.dhcpd
if options.kickstart:
def generate(tree, auto_domain):
result = []
result.append(("auto.home", auto_map(tree, 'auto.home', auto_domain)))
result.append(("", auto_map(tree, '', auto_domain)))
return result
def auto_map(tree, map_name, auto_domain):
auto = {}
for h in tree._host_:
for a in h._automount_:
if[0] == map_name:
for e in a._entry_:
host =[0]
if auto_domain:
host += auto_domain
path = '/'.join([a.root[0], e.path[0]])
auto[e.key[0]] = "%s:%s" % (host, path)
ak = auto.keys()
result = ""
for k in ak:
result += "%-15s %s\n" % (k, auto[k])
return result
Supports Markdown
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