X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=lib%2FApp%2FGroupSecret.pm;h=01f8e6130617915f805f393f7173bda5192c84e3;hb=HEAD;hp=98f321232d184d112fedb75f82cd105e4719e17d;hpb=08cddfc84b3aadcd447b708d89b560e21015faac;p=chaz%2Fgroupsecret diff --git a/lib/App/GroupSecret.pm b/lib/App/GroupSecret.pm index 98f3212..01f8e61 100644 --- a/lib/App/GroupSecret.pm +++ b/lib/App/GroupSecret.pm @@ -16,7 +16,7 @@ our $VERSION = '9999.999'; # VERSION use App::GroupSecret::Crypt qw(generate_secure_random_bytes read_openssh_key_fingerprint); use App::GroupSecret::File; -use Getopt::Long qw(GetOptionsFromArray); +use Getopt::Long 2.38 qw(GetOptionsFromArray); use MIME::Base64; use Pod::Usage; use namespace::clean; @@ -114,7 +114,6 @@ Get the path to the keyfile. sub filepath { shift->{filepath} ||= $ENV{GROUPSECRET_KEYFILE} || 'groupsecret.yml'; - } =method file @@ -152,7 +151,11 @@ sub _action_print_secret { ) or pod2usage(2); my $file = $self->file; - die "No secret in file -- use the \`set-secret' command to set one.\n" if !$file->secret; + my $filepath = $file->filepath; + die "No keyfile '$filepath' exists -- use the \`add-key' command to create one.\n" + unless -e $filepath && !-d $filepath; + die "No secret in keyfile '$filepath' exists -- use the \`set-secret' command to set one.\n" + if !$file->secret; if ($decrypt) { my $private_key = $self->private_key;