summaryrefslogtreecommitdiff
path: root/usr/src/pinyadmin/bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/pinyadmin/bin')
-rwxr-xr-xusr/src/pinyadmin/bin/pinyconfig20
1 files changed, 18 insertions, 2 deletions
diff --git a/usr/src/pinyadmin/bin/pinyconfig b/usr/src/pinyadmin/bin/pinyconfig
index ec8e80a..e18ac30 100755
--- a/usr/src/pinyadmin/bin/pinyconfig
+++ b/usr/src/pinyadmin/bin/pinyconfig
@@ -7,12 +7,28 @@ use Piny;
my ( $reponame, $attr, $value ) = @ARGV;
+if ( not defined $reponame or not defined $attr ) {
+ die "Usage: $0 reponame tweakable [value]\n";
+};
+
$attr =~ s/\./_/g;
my $repo = Piny::Repo->new( $reponame );
if ( defined $value ) {
- $repo->config->$attr( $value );
+ undef $@;
+ eval {
+ $repo->config->$attr( $value );
+ };
+ if ( defined $@ ) {
+ print STDERR "$attr is not a legal tweakable, or $value is not a legal value for that tweakable.\n$@\n";
+ };
};
-print "$attr = " . $repo->config->$attr . "\n";
+undef $@;
+eval {
+ print "$attr = " . $repo->config->$attr . "\n";
+};
+if ( defined $@ ) {
+ print STDERR "$attr is not a legal tweakable, or its current value is illegal.\n$@\n";
+};