summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDongInn Kim <dikim33@gmail.com>2012-05-14 11:01:13 -0400
committerDongInn Kim <dikim33@gmail.com>2012-05-14 11:01:13 -0400
commit162040a5d729d82e06c2a991c37fded3931676a4 (patch)
treedfc2ebf234a00cb4a4e4f5ed92f40ce1feb1b0a8 /tools
parent54742914b6182b23beaf461132776dcf16340e71 (diff)
downloadbcfg2-162040a5d729d82e06c2a991c37fded3931676a4.tar.gz
bcfg2-162040a5d729d82e06c2a991c37fded3931676a4.tar.bz2
bcfg2-162040a5d729d82e06c2a991c37fded3931676a4.zip
Store group="name" rather than gid="GID" at the attribute of UnixUser.
This fixes the wrong behavior of creating the usergroup data. Thanks emias for helping me out this problem.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/accounts2xml.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/accounts2xml.py b/tools/accounts2xml.py
index 590e0041d..183a70174 100755
--- a/tools/accounts2xml.py
+++ b/tools/accounts2xml.py
@@ -60,6 +60,7 @@ import sys
import csv
import os
import re
+import grp
from xml.dom.minidom import Document
def main(args):
@@ -112,8 +113,12 @@ def main(args):
def create_col_nodes(cols, item, doc, row):
for col in cols:
- att = doc.createAttribute(str.replace(col, " ", "_").lower())
- att.nodeValue = row.pop(0)
+ if col == "gid":
+ att = doc.createAttribute("group")
+ att.nodeValue = grp.getgrgid(int(row.pop(0)))[0]
+ else:
+ att = doc.createAttribute(str.replace(col, " ", "_").lower())
+ att.nodeValue = row.pop(0)
if col != "pass":
item.setAttributeNode(att)