[libvirt] [jenkins-ci PATCH] lcitool: Use Perl to generate password hashes
Andrea Bolognani
abologna at redhat.com
Thu May 17 14:10:37 UTC 2018
On Thu, 2018-05-17 at 14:18 +0100, Daniel P. Berrangé wrote:
> On Thu, May 17, 2018 at 03:09:11PM +0200, Andrea Bolognani wrote:
> > Perl to the rescue! The script ends up being only marginally
> > more verbose and obscure as a result, the indentation is
> > significantly better, and it should finally run on pretty
> > much any platform.
> >
> > Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> > ---
> > guests/lcitool | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
>
> Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>
A friend suggested
diff --git a/guests/lcitool b/guests/lcitool
index 568e52c..5855368 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -21,7 +21,7 @@ hash_file() {
perl -le '
my @chars = ("A".."Z", "a".."z", "0".."9");
my $salt; $salt .= $chars[rand @chars] for 1..16;
- open(my $handle, "'"$PASS_FILE"'"); my $pass = <$handle>; chomp $pass;
+ open(my $handle, "'"$PASS_FILE"'"); chomp(my $pass = <$handle>);
print crypt("$pass", "\$6\$$salt\$");'
}
would be more idiomatic: mind if I squash that in before pushing?
--
Andrea Bolognani / Red Hat / Virtualization
More information about the libvir-list
mailing list