File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -227,14 +227,17 @@ def ask_user(user_conf):
227227 if set_host .lower () == 'yes' :
228228 txt = 'Input the FQDN hostname you want to use for this host: '
229229 user_conf ['hostname' ] = utils .ask_user (txt , check = utils .check_hostname )
230- else :
231- user_conf ['hostname' ] = open (HOSTFILE , 'r' ).read ().strip ()
232230
233231 def validation (user_conf ):
234- utils .valid_print ('hostname' , user_conf ['hostname' ])
232+ if 'hostname' in user_conf .keys ():
233+ utils .valid_print ('hostname' , user_conf ['hostname' ])
235234
236235 def run (user_conf ):
237- open (HOSTFILE , 'w' ).write (user_conf ['hostname' ] + '\n ' )
236+ if 'hostname' in user_conf .keys ():
237+ open (HOSTFILE , 'w' ).write (user_conf ['hostname' ] + '\n ' )
238+ else :
239+ # Get hostname from /etc/hostname if user has set it manually.
240+ user_conf ['hostname' ] = open (HOSTFILE , 'r' ).read ().strip ()
238241
239242 ec = ESCFG ('setup hostname of this host' )
240243 ec .ask_user = ask_user
You can’t perform that action at this time.
0 commit comments