summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDongInn Kim <dikim33@gmail.com>2012-05-14 11:01:13 -0400
committerSol Jerome <sol.jerome@gmail.com>2012-05-14 11:10:55 -0500
commitc685761bdcea79f5e8b115f2ba48935176518925 (patch)
tree4d4ae8976843d1cb92cd8cd961822e25dce0cb39 /tools
parent9e72515db88a7de8ccdde256314c2671cc011bbb (diff)
downloadbcfg2-c685761bdcea79f5e8b115f2ba48935176518925.tar.gz
bcfg2-c685761bdcea79f5e8b115f2ba48935176518925.tar.bz2
bcfg2-c685761bdcea79f5e8b115f2ba48935176518925.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)