#NEWLINE# def do_registrar( self , db , dry_run , change_master , offline ) : #NEWLINE# #INDENT# 'Setup hostname for a newly bootstraped server.\n\n        Args:\n            db: mongodb database reference.\n            dry_run: bool, should we actually apply changes.\n            change_master: bool, should we swap masters.\n            offline: bool, should we connect to aws.\n        Returns:\n            bool, True if system settings are correctly changed.\n        ' #NEWLINE# ( service , service_type , aliases ) = self . parse_service_info ( ) #NEWLINE# ( instance_id , local_ip ) = aerostat . get_aws_data ( offline ) #NEWLINE# if change_master : #NEWLINE# #INDENT# self . change_master ( db , service , service_type , instance_id ) #NEWLINE# return True #NEWLINE# #UNINDENT# hostname = self . pick_name ( service , service , service_type , instance_id ) #NEWLINE# change_host = False #NEWLINE# if dry_run : #NEWLINE# #INDENT# logging . debug ( ( 'DRY RUN: you would register with: %s' % hostname ) ) #NEWLINE# return False #NEWLINE# #UNINDENT# if hostname : #NEWLINE# #INDENT# change_host = self . set_sys_hostname ( hostname ) #NEWLINE# #UNINDENT# if change_host : #NEWLINE# #INDENT# self . register_name ( db , hostname , local_ip , instance_id , service , service_type , aliases ) #NEWLINE# #UNINDENT# return True