File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -76,17 +76,15 @@ def __init__(self):
76
76
parser .add_option_group (group )
77
77
parser .add_option_group (bootstrap_group )
78
78
self .args , commands = parser .parse_args ()
79
- if len (commands ) > 0 :
80
- if len (commands ) == 1 :
81
- self .args .dbname = commands [0 ]
82
- else :
83
- parser .print_help ()
84
- sys .exit (1 )
85
79
if self .args .dbname is None :
86
80
try :
87
81
cfg = Config (self .args .config )
88
82
self .args .dbname = cfg .fetch ('postgres' , 'database' )
83
+ # apply dbname env
84
+ os .environ ['PGDATABASE' ] = self .args .dbname
89
85
except Exception as e :
86
+ # apply dbname env
87
+ os .environ ['PGDATABASE' ] = self .args .username
90
88
sys .stderr .write ("ERROR: Database for mamonsu is not specified\n " )
91
89
sys .stderr .write ("{0}\n " .format (e ))
92
90
parser .print_bootstrap_help ()
@@ -97,7 +95,6 @@ def __init__(self):
97
95
os .environ ['PGPASSWORD' ] = self .args .password
98
96
os .environ ['PGHOST' ] = self .args .hostname
99
97
os .environ ['PGPORT' ] = str (self .args .port )
100
- os .environ ['PGDATABASE' ] = self .args .username if self .args .dbname is None else self .args .dbname
101
98
os .environ ['PGAPPNAME' ] = 'mamonsu deploy'
102
99
103
100
def try_configure_connect_to_pg (self ):
You can’t perform that action at this time.
0 commit comments