def db_aws_set_region(self, region_name):
        ''' Set AWS region '''
        # interactive = False # Not used
        if region_name is None:
            # interactive = True  # Not used
            self.db_aws_list_regions()
            allowed_regions = self.db_services.list_regions()
            region_name = "NONSENSE WORD1234"
            tries = 0
            while region_name not in allowed_regions:
                if tries == 0:
                    region_name = raw_input('Enter the name of the region you '
                                            'would like to use: ')
                else:
                    print("*** The region name (%s) you entered is not allowed, " \
                          "please choose from the list printed above (use type 'db " \
                          "aws_list_regions'." % region_name)
                    region_name = raw_input('Enter the name of the region you '
                                            'would like to use: ')
                tries += 1
                if tries > 5:
                    print("*** Error, region you are requesting not available.  "
                          "No changes made to regions.")
                    return
        self.db_services.set_region(region_name)
        print "Region updated to ", region_name
        self.config.set('AWS Access', 'aws_region', region_name, True)
        if self.server.is_server_running() == 'yes':
            self.server_restart()
def db_aws_set_region ( self , region_name ) : if region_name is None : self . db_aws_list_regions ( ) allowed_regions = self . db_services . list_regions ( ) region_name = "NONSENSE WORD1234" tries = 0 while region_name not in allowed_regions : if tries == 0 : region_name = raw_input ( 'Enter the name of the region you ' 'would like to use: ' ) else : print ( "*** The region name (%s) you entered is not allowed, " "please choose from the list printed above (use type 'db " "aws_list_regions'." % region_name ) region_name = raw_input ( 'Enter the name of the region you ' 'would like to use: ' ) tries += 1 if tries > 5 : print ( "*** Error, region you are requesting not available.  " "No changes made to regions." ) return self . db_services . set_region ( region_name ) print "Region updated to " , region_name self . config . set ( 'AWS Access' , 'aws_region' , region_name , True ) if self . server . is_server_running ( ) == 'yes' : self . server_restart ( )
Set AWS region