[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Update to tools/drop-roles.pl
- Subject: Update to tools/drop-roles.pl
- From: Chris Bennett <..hidden..>
- Date: Wed, 17 Oct 2012 15:14:51 -0500
I added a --no_postgres_pass option.
Diff attached.
Should the name of this be changed since it also drops a company?
Chris Bennett
--- /home/chris101/LSMB/ledgersmb/tools/drop-roles.pl Tue Mar 27 20:34:52 2012
+++ /var/www/var/www/htdocs/users/ledgersmb/tools/drop-roles.pl Wed Oct 17 15:05:02 2012
@@ -11,6 +11,7 @@
my $postgres_username = 'postgres';
my $postgres_password;
my $postgres_db = 'postgres';
+my $no_postgres_pass = 0;
my $company_name;
my @other_roles;
my $progress;
@@ -20,7 +21,8 @@
Available options:
--company The name of the database to be dropped [*]
--postgres_username postgres username, only use if not [$postgres_username]
- --postgres_password postgres user password. Defaults to none [*]
+ --postgres_password postgres user password. [*] Required unless --no_postgres_pass
+ --no_postgres_pass Means no postgres password is needed
--postgres_db postgres database name. Defaults to [$postgres_db]
--owner The superuser owner of database [optional]
--role Repeat to add other roles to be dropped, such as 'admin'
@@ -37,6 +39,7 @@
'role:s' => \@other_roles,
'postgres_username:s' => \$postgres_username,
'postgres_password=s' => \$postgres_password,
+ 'no_postgres_pass' => \$no_postgres_pass,
'postgres_db:s' => \$postgres_db,
'progress' => \$progress,
'help|?|h' => \$help
@@ -53,7 +56,7 @@
exit;
}
-unless ($postgres_password) {
+unless (($postgres_password) || ($no_postgres_pass)) {
print $usage;
print "\nmissing or empty --postgres_password option\n";
exit;