[node-patches] Change in ovirt-node[master]: password: Replace libuser and update the persist/unpersist c...

rbarry at redhat.com rbarry at redhat.com
Tue Nov 10 14:17:35 UTC 2015


Ryan Barry has posted comments on this change.

Change subject: password: Replace libuser and update the persist/unpersist calls
......................................................................


Patch Set 3: -Code-Review

(1 comment)

https://gerrit.ovirt.org/#/c/48216/3/src/ovirtnode/password.py
File src/ovirtnode/password.py:

Line 49:         #
Line 50:         with open("/etc/shadow", "r") as f:
Line 51:             shadow_file = f.readlines()
Line 52: 
Line 53:         with open("/etc/shadow", "w") as f:
> If we decide to go to this approach we could use a random /tmp/filename her
I think that, if we're going to go this way, it would also be nice to create some datastructure to hold the fields, even if it's just a namedtuple.

The fields in shadow/passwd are pretty well known, but:

if entry.username == "admin" or...

And:

entry.hash = "{0}".format(...

Look somewhat nicer IMO
Line 54:             for line in shadow_file:
Line 55:                 if line.split(":")[0] == "admin" or \
Line 56:                         line.split(":")[0] == "root":
Line 57:                     shadow_entry = line.split(":")


-- 
To view, visit https://gerrit.ovirt.org/48216
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie8a1b3fe1343e6820e83e2a9db8ff6715d959336
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>
Gerrit-Reviewer: Anatoly Litovsky <tlitovsk at redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland at redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Ryan Barry <rbarry at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes



More information about the node-patches mailing list