summaryrefslogtreecommitdiffstats
path: root/plugins/passwd.py
diff options
context:
space:
mode:
authorJoel Andres Granados <jgranado@redhat.com>2008-07-14 19:11:16 +0200
committerJoel Andres Granados <jgranado@redhat.com>2008-07-14 19:11:16 +0200
commitc99167e6d3fa4619b07a22ee8c6863c873adddb5 (patch)
tree7ee0040a04ca61adc91d78aed53c9b526af936bd /plugins/passwd.py
parenta76a1fe312dba303e3655a0aecb4904c406caaa0 (diff)
downloadfirstaidkit-c99167e6d3fa4619b07a22ee8c6863c873adddb5.tar.gz
firstaidkit-c99167e6d3fa4619b07a22ee8c6863c873adddb5.tar.xz
firstaidkit-c99167e6d3fa4619b07a22ee8c6863c873adddb5.zip
Clean up passwd.py file.
Diffstat (limited to 'plugins/passwd.py')
-rw-r--r--plugins/passwd.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/plugins/passwd.py b/plugins/passwd.py
index 79139b7..508ec0b 100644
--- a/plugins/passwd.py
+++ b/plugins/passwd.py
@@ -25,16 +25,19 @@ from random import Random
rng = Random()
class PasswdPlugin(Plugin):
- """This plugin provides operations for convenient manipulation with the password system."""
+ """This plugin provides operations for convenient manipulation with the
+ password system."""
#
# Additional flow defprepareion.
#
- # flows = Flow.init(Plugin) # we do not need the default fix and diagnose flows
+ # flows = Flow.init(Plugin) # we do not need the default fix and diagnose
+ # flows
flows = {}
flows["resetRoot"] = Flow({
Plugin.initial: {Return: "resetRoot"},
"resetRoot" : {ReturnSuccess: Plugin.final}
- }, description="Reset root password to random value so the user can login and change it")
+ }, description="Reset root password to random value so " \
+ "the user can login and change it")
name = "Password plugin"
version = "0.0.1"
@@ -48,14 +51,17 @@ class PasswdPlugin(Plugin):
Plugin.__init__(self, *args, **kwargs)
def resetRoot(self):
- charlist = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ.,"
+ charlist = "abcdefghijklmnopqrstuvwxyz" \
+ "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ.,"
passlen = 10
newpasswd = []
while len(newpasswd)<passlen:
newpasswd.append(rng.choice(charlist))
- print spawnvch(executable = "/usr/bin/passwd", args = ["/usr/bin/passwd", "root"],
- chroot = Config.system.root).communicate(input = "%s\n%s\n"%(newpasswd,newpasswd))
+ print spawnvch(executable = "/usr/bin/passwd",
+ args = ["/usr/bin/passwd", "root"],
+ chroot = Config.system.root).communicate(
+ input = "%s\n%s\n"%(newpasswd,newpasswd))
self._reporting.info("Root password was reset to '%s'" %
("".join(newpasswd),), level = PLUGIN, origin = self)