def write(self): # We have more than just the root user, so we need to add that first. if self.users: self.provideAccess("root") for userDict in self.users: try: argv = ["/usr/sbin/useradd", userDict['username']] execWithRedirect(argv[0], argv, root=HOST_ROOT) argv = [ "/usr/bin/chfn", "-f", userDict['fullName'], userDict['username'] ] execWithRedirect(argv[0], argv, root=HOST_ROOT) except RuntimeError, msg: log.error("Error running %s: %s" % (string.join(argv), msg[0])) if userDict['passwordType'] == userchoices.USERPASSWORD_TYPE_MD5: useMD5 = True elif userDict['passwordType'] == \ userchoices.USERPASSWORD_TYPE_CRYPT: useMD5 = False else: raise ValueError, "Don't know how to crypt password." passwd = Password(userDict['username'], userDict['password'], useMD5=useMD5) passwd.write() self.provideAccess(userDict['username'])
def write(self): # We have more than just the root user, so we need to add that first. if self.users: self.provideAccess("root") for userDict in self.users: try: argv = ["/usr/sbin/useradd", userDict['username']] execWithRedirect(argv[0], argv, root=HOST_ROOT) argv = ["/usr/bin/chfn", "-f", userDict['fullName'], userDict['username']] execWithRedirect(argv[0], argv, root=HOST_ROOT) except RuntimeError, msg: log.error("Error running %s: %s" % (string.join(argv), msg[0])) if userDict['passwordType'] == userchoices.USERPASSWORD_TYPE_MD5: useMD5 = True elif userDict['passwordType'] == \ userchoices.USERPASSWORD_TYPE_CRYPT: useMD5 = False else: raise ValueError, "Don't know how to crypt password." passwd = Password(userDict['username'], userDict['password'], useMD5=useMD5) passwd.write() self.provideAccess(userDict['username'])
def doStartupX11Actions(): global miniwm_pid f = open("/tmp/mylog", "w") # now start up mini-wm try: miniwm_pid = startMiniWM() print "Started mini-wm" f.write(" * Started mini-wm\n") f.write("miniwm_pid=%s\n" % (miniwm_pid)) except: miniwm_pid = None print "Unable to start mini-wm" # test to setup dpi # cant do this if miniwm didnt run because otherwise when # we open and close an X connection in the xutils calls # the X server will exit since this is the first X # connection (if miniwm isnt running) if miniwm_pid is not None: # try to start up xrandr try: argv = ["/usr/bin/xrandr", "-s", RUNRES, "-r", REFRESH] util.execWithRedirect(argv[0], argv, searchPath=1, stdout="/dev/tty5", stderr="/dev/tty5") # We expect an OSError at this point, the child completed successfully. except OSError, e: if str(e): log.error("Exception when running xrandr: %s" % str(e)) else: pass except Exception, e: log.error("Exception when running xrandr: %s" % str(e))
def write(self): try: argv = ["/usr/sbin/usermod", "-p", self.password, self.account] execWithRedirect(argv[0], argv, root=HOST_ROOT, stderr=None) except RuntimeError, msg: log.error("Error running %s: %s" % (string.join(argv), msg[0]))
def write(self): try: argv = [ "/usr/sbin/usermod", "-p", self.password, self.account ] execWithRedirect(argv[0], argv, root=HOST_ROOT, stderr=None) except RuntimeError, msg: log.error("Error running %s: %s" % (string.join(argv), msg[0]))