def test_simple_layout_options(self): # Using Euca with no input yaml, and no max or min images is not ok options_1 = self.default_options.copy() options_1['infrastructure'] = 'euca' layout_1 = NodeLayout(options_1) self.assertEquals(False, layout_1.is_valid()) self.assertEquals(NodeLayout.NO_YAML_REQUIRES_MIN, layout_1.errors()) options_2 = self.default_options.copy() options_2['infrastructure'] = "euca" options_2['max'] = 2 layout_2 = NodeLayout(options_2) self.assertEquals(False, layout_2.is_valid()) self.assertEquals(NodeLayout.NO_YAML_REQUIRES_MIN, layout_2.errors()) options_3 = self.default_options.copy() options_3['infrastructure'] = "euca" options_3['min'] = 2 layout_3 = NodeLayout(options_3) self.assertEquals(False, layout_3.is_valid()) self.assertEquals(NodeLayout.NO_YAML_REQUIRES_MAX, layout_3.errors()) # Using Euca with no input yaml, with max and min images set is ok options_4 = self.default_options.copy() options_4['infrastructure'] = "euca" options_4['min'] = 2 options_4['max'] = 2 layout_4 = NodeLayout(options_4) self.assertEquals(True, layout_4.is_valid()) # Using virtualized deployments with no input yaml is not ok options_5 = self.default_options.copy() layout_5 = NodeLayout(options_5) self.assertEquals(False, layout_5.is_valid()) self.assertEquals([NodeLayout.INPUT_YAML_REQUIRED], layout_5.errors())
def test_dont_warn_users_on_supported_deployment_strategies(self): # all simple deployment strategies are supported input_yaml_1 = {'controller': self.ip_1} options_1 = self.default_options.copy() options_1['ips'] = input_yaml_1 layout_1 = NodeLayout(options_1) self.assertEquals(True, layout_1.is_supported()) input_yaml_2 = {'controller': self.ip_1, 'servers': [self.ip_2]} options_2 = self.default_options.copy() options_2['ips'] = input_yaml_2 layout_2 = NodeLayout(options_2) self.assertEquals(True, layout_2.is_supported()) input_yaml_3 = { 'controller': self.ip_1, 'servers': [self.ip_2, self.ip_3] } options_3 = self.default_options.copy() options_3['ips'] = input_yaml_3 layout_3 = NodeLayout(options_3) self.assertEquals(True, layout_3.is_supported()) # in advanced deployments, four nodes are ok with the following # layout: (1) load balancer, (2) appserver, (3) database, # (4) zookeeper advanced_yaml_1 = { 'master': self.ip_1, 'appengine': self.ip_2, 'database': self.ip_3, 'zookeeper': self.ip_4 } options_1 = self.default_options.copy() options_1['ips'] = advanced_yaml_1 advanced_layout_1 = NodeLayout(options_1) self.assertEquals(True, advanced_layout_1.is_valid()) self.assertEquals(True, advanced_layout_1.is_supported()) # in advanced deployments, eight nodes are ok with the following # layout: (1) load balancer, (2) appserver, (3) appserver, # (4) database, (5) database, (6) zookeeper, (7) zookeeper, # (8) zookeeper advanced_yaml_2 = { 'master': self.ip_1, 'appengine': [self.ip_2, self.ip_3], 'database': [self.ip_4, self.ip_5], 'zookeeper': [self.ip_6, self.ip_7, self.ip_8] } options_2 = self.default_options.copy() options_2['ips'] = advanced_yaml_2 advanced_layout_2 = NodeLayout(options_2) self.assertEquals(True, advanced_layout_2.is_valid()) self.assertEquals(True, advanced_layout_2.is_supported())
def test_dont_warn_users_on_supported_deployment_strategies(self): # all simple deployment strategies are supported input_yaml_1 = {'controller' : self.ip_1} options_1 = self.default_options.copy() options_1['ips'] = input_yaml_1 layout_1 = NodeLayout(options_1) self.assertEquals(True, layout_1.is_supported()) input_yaml_2 = {'controller' : self.ip_1, 'servers' : [self.ip_2]} options_2 = self.default_options.copy() options_2['ips'] = input_yaml_2 layout_2 = NodeLayout(options_2) self.assertEquals(True, layout_2.is_supported()) input_yaml_3 = {'controller' : self.ip_1, 'servers' : [self.ip_2, self.ip_3]} options_3 = self.default_options.copy() options_3['ips'] = input_yaml_3 layout_3 = NodeLayout(options_3) self.assertEquals(True, layout_3.is_supported()) # in advanced deployments, four nodes are ok with the following # layout: (1) load balancer, (2) appserver, (3) database, # (4) zookeeper advanced_yaml_1 = { 'master' : self.ip_1, 'appengine' : self.ip_2, 'database' : self.ip_3, 'zookeeper' : self.ip_4 } options_1 = self.default_options.copy() options_1['ips'] = advanced_yaml_1 advanced_layout_1 = NodeLayout(options_1) self.assertEquals(True, advanced_layout_1.is_valid()) self.assertEquals(True, advanced_layout_1.is_supported()) # in advanced deployments, eight nodes are ok with the following # layout: (1) load balancer, (2) appserver, (3) appserver, # (4) database, (5) database, (6) zookeeper, (7) zookeeper, # (8) zookeeper advanced_yaml_2 = { 'master' : self.ip_1, 'appengine' : [self.ip_2, self.ip_3], 'database' : [self.ip_4, self.ip_5], 'zookeeper' : [self.ip_6, self.ip_7, self.ip_8] } options_2 = self.default_options.copy() options_2['ips'] = advanced_yaml_2 advanced_layout_2 = NodeLayout(options_2) self.assertEquals(True, advanced_layout_2.is_valid()) self.assertEquals(True, advanced_layout_2.is_supported())
def test_advanced_format_yaml_only(self): input_yaml = {'master' : self.ip_1, 'database' : self.ip_1, 'appengine' : self.ip_1, 'open' : self.ip_2} options = self.default_options.copy() options['ips'] = input_yaml layout_1 = NodeLayout(options) self.assertEquals(True, layout_1.is_valid())
def test_warn_users_on_unsupported_deployment_strategies(self): # don't test simple deployments - those are all supported # instead, test out some variations of the supported advanced # strategies, as those should not be supported advanced_yaml_1 = { 'master' : self.ip_1, 'appengine' : self.ip_1, 'database' : self.ip_2, 'zookeeper' : self.ip_2 } options_1 = self.default_options.copy() options_1['ips'] = advanced_yaml_1 advanced_layout_1 = NodeLayout(options_1) self.assertEquals(True, advanced_layout_1.is_valid()) self.assertEquals(False, advanced_layout_1.is_supported()) # four node deployments that don't match the only supported # deployment are not supported advanced_yaml_2 = { 'master' : self.ip_1, 'appengine' : self.ip_2, 'database' : self.ip_3, 'zookeeper' : self.ip_3, 'open' : self.ip_4 } options_2 = self.default_options.copy() options_2['ips'] = advanced_yaml_2 advanced_layout_2 = NodeLayout(options_2) self.assertEquals(True, advanced_layout_2.is_valid()) self.assertEquals(False, advanced_layout_2.is_supported()) # eight node deployments that don't match the only supported # deployment are not supported advanced_yaml_3 = { 'master' : self.ip_1, 'appengine' : [self.ip_2, self.ip_3], 'database' : [self.ip_4, self.ip_5], 'zookeeper' : [self.ip_6, self.ip_7], 'open' : self.ip_8 } options_3 = self.default_options.copy() options_3['ips'] = advanced_yaml_3 advanced_layout_3 = NodeLayout(options_3) self.assertEquals(True, advanced_layout_3.is_valid()) self.assertEquals(False, advanced_layout_3.is_supported())
def test_warn_users_on_unsupported_deployment_strategies(self): # don't test simple deployments - those are all supported # instead, test out some variations of the supported advanced # strategies, as those should not be supported advanced_yaml_1 = { 'master': self.ip_1, 'appengine': self.ip_1, 'database': self.ip_2, 'zookeeper': self.ip_2 } options_1 = self.default_options.copy() options_1['ips'] = advanced_yaml_1 advanced_layout_1 = NodeLayout(options_1) self.assertEquals(True, advanced_layout_1.is_valid()) self.assertEquals(False, advanced_layout_1.is_supported()) # four node deployments that don't match the only supported # deployment are not supported advanced_yaml_2 = { 'master': self.ip_1, 'appengine': self.ip_2, 'database': self.ip_3, 'zookeeper': self.ip_3, 'open': self.ip_4 } options_2 = self.default_options.copy() options_2['ips'] = advanced_yaml_2 advanced_layout_2 = NodeLayout(options_2) self.assertEquals(True, advanced_layout_2.is_valid()) self.assertEquals(False, advanced_layout_2.is_supported()) # eight node deployments that don't match the only supported # deployment are not supported advanced_yaml_3 = { 'master': self.ip_1, 'appengine': [self.ip_2, self.ip_3], 'database': [self.ip_4, self.ip_5], 'zookeeper': [self.ip_6, self.ip_7], 'open': self.ip_8 } options_3 = self.default_options.copy() options_3['ips'] = advanced_yaml_3 advanced_layout_3 = NodeLayout(options_3) self.assertEquals(True, advanced_layout_3.is_valid()) self.assertEquals(False, advanced_layout_3.is_supported())
def add_keypair(cls, options): """Sets up passwordless SSH login to the machines used in a virtualized cluster deployment. Args: options: A Namespace that has fields for each parameter that can be passed in via the command-line interface. """ LocalState.require_ssh_commands(options.auto, options.verbose) LocalState.make_appscale_directory() path = LocalState.LOCAL_APPSCALE_PATH + options.keyname if options.add_to_existing: public_key = path + ".pub" private_key = path else: public_key, private_key = LocalState.generate_rsa_key( options.keyname, options.verbose) if options.auto: if 'root_password' in options: AppScaleLogger.log("Using the provided root password to log into " + \ "your VMs.") password = options.root_password else: AppScaleLogger.log("Please enter the password for the root user on" + \ " your VMs:") password = getpass.getpass() node_layout = NodeLayout(options) if not node_layout.is_valid(): raise BadConfigurationException("There were problems with your " + \ "placement strategy: " + str(node_layout.errors())) all_ips = [node.public_ip for node in node_layout.nodes] for ip in all_ips: # first, set up passwordless ssh AppScaleLogger.log( "Executing ssh-copy-id for host: {0}".format(ip)) if options.auto: LocalState.shell( "{0} root@{1} {2} {3}".format(cls.EXPECT_SCRIPT, ip, private_key, password), options.verbose) else: LocalState.shell( "ssh-copy-id -i {0} root@{1}".format(private_key, ip), options.verbose) # next, copy over the ssh keypair we generate RemoteHelper.scp(ip, options.keyname, public_key, '/root/.ssh/id_rsa.pub', options.verbose) RemoteHelper.scp(ip, options.keyname, private_key, '/root/.ssh/id_rsa', options.verbose) AppScaleLogger.success("Generated a new SSH key for this deployment " + \ "at {0}".format(private_key))
def add_keypair(cls, options): """Sets up passwordless SSH login to the machines used in a virtualized cluster deployment. Args: options: A Namespace that has fields for each parameter that can be passed in via the command-line interface. Raises: AppScaleException: If any of the machines named in the ips_layout are not running, or do not have the SSH daemon running. """ LocalState.require_ssh_commands(options.auto, options.verbose) LocalState.make_appscale_directory() path = LocalState.LOCAL_APPSCALE_PATH + options.keyname if options.add_to_existing: public_key = path + ".pub" private_key = path else: public_key, private_key = LocalState.generate_rsa_key(options.keyname, options.verbose) if options.auto: if 'root_password' in options: AppScaleLogger.log("Using the provided root password to log into " + \ "your VMs.") password = options.root_password else: AppScaleLogger.log("Please enter the password for the root user on" + \ " your VMs:") password = getpass.getpass() node_layout = NodeLayout(options) if not node_layout.is_valid(): raise BadConfigurationException("There were problems with your " + \ "placement strategy: " + str(node_layout.errors())) all_ips = [node.public_ip for node in node_layout.nodes] for ip in all_ips: # first, make sure ssh is actually running on the host machine if not RemoteHelper.is_port_open(ip, RemoteHelper.SSH_PORT, options.verbose): raise AppScaleException("SSH does not appear to be running at {0}. " \ "Is the machine at {0} up and running? Make sure your IPs are " \ "correct!".format(ip)) # next, set up passwordless ssh AppScaleLogger.log("Executing ssh-copy-id for host: {0}".format(ip)) if options.auto: LocalState.shell("{0} root@{1} {2} {3}".format(cls.EXPECT_SCRIPT, ip, private_key, password), options.verbose) else: LocalState.shell("ssh-copy-id -i {0} root@{1}".format(private_key, ip), options.verbose) AppScaleLogger.success("Generated a new SSH key for this deployment " + \ "at {0}".format(private_key))
def test_with_wrong_number_of_disks(self): # suppose that the user has specified two nodes, but only one EBS / PD disk # this should fail. input_yaml = {'controller': self.ip_1, 'servers': [self.ip_2]} options = self.default_options.copy() options['ips'] = input_yaml options['disks'] = {self.ip_1: 'disk_number_one'} layout = NodeLayout(options) self.assertEquals(False, layout.is_valid())
def test_advanced_format_yaml_only(self): input_yaml = { 'master': self.ip_1, 'database': self.ip_1, 'appengine': self.ip_1, 'open': self.ip_2 } options = self.default_options.copy() options['ips'] = input_yaml layout_1 = NodeLayout(options) self.assertEquals(True, layout_1.is_valid())
def add_keypair(cls, options): """Sets up passwordless SSH login to the machines used in a virtualized cluster deployment. Args: options: A Namespace that has fields for each parameter that can be passed in via the command-line interface. """ LocalState.require_ssh_commands(options.auto, options.verbose) LocalState.make_appscale_directory() path = LocalState.LOCAL_APPSCALE_PATH + options.keyname if options.add_to_existing: public_key = path + ".pub" private_key = path else: public_key, private_key = LocalState.generate_rsa_key(options.keyname, options.verbose) if options.auto: if 'root_password' in options: AppScaleLogger.log("Using the provided root password to log into " + \ "your VMs.") password = options.root_password else: AppScaleLogger.log("Please enter the password for the root user on" + \ " your VMs:") password = getpass.getpass() node_layout = NodeLayout(options) if not node_layout.is_valid(): raise BadConfigurationException("There were problems with your " + \ "placement strategy: " + str(node_layout.errors())) all_ips = [node.public_ip for node in node_layout.nodes] for ip in all_ips: # first, set up passwordless ssh AppScaleLogger.log("Executing ssh-copy-id for host: {0}".format(ip)) if options.auto: LocalState.shell("{0} root@{1} {2} {3}".format(cls.EXPECT_SCRIPT, ip, private_key, password), options.verbose) else: LocalState.shell("ssh-copy-id -i {0} root@{1}".format(private_key, ip), options.verbose) # next, copy over the ssh keypair we generate RemoteHelper.scp(ip, options.keyname, public_key, '/root/.ssh/id_rsa.pub', options.verbose) RemoteHelper.scp(ip, options.keyname, private_key, '/root/.ssh/id_rsa', options.verbose) AppScaleLogger.success("Generated a new SSH key for this deployment " + \ "at {0}".format(private_key))
def test_with_right_number_of_disks_but_not_unique(self): # suppose that the user has specified two nodes, but uses the same name for # both disks. This isn't acceptable. input_yaml = {'controller': self.ip_1, 'servers': [self.ip_2]} options = self.default_options.copy() options['ips'] = input_yaml options['disks'] = { self.ip_1: 'disk_number_one', self.ip_2: 'disk_number_one' } layout = NodeLayout(options) self.assertEquals(False, layout.is_valid())
def upgrade(cls, options): """ Upgrades the deployment to the latest AppScale version. Args: options: A Namespace that has fields for each parameter that can be passed in via the command-line interface. """ node_layout = NodeLayout(options) if not node_layout.is_valid(): raise BadConfigurationException( 'Your ips_layout is invalid:\n{}'.format(node_layout.errors())) latest_tools = APPSCALE_VERSION try: AppScaleLogger.log( 'Checking if an update is available for appscale-tools') latest_tools = latest_tools_version() except: # Prompt the user if version metadata can't be fetched. if not options.test: response = raw_input( 'Unable to check for the latest version of appscale-tools. Would ' 'you like to continue upgrading anyway? (y/N) ') if response.lower() not in ['y', 'yes']: raise AppScaleException('Cancelled AppScale upgrade.') if latest_tools > APPSCALE_VERSION: raise AppScaleException( "There is a newer version ({}) of appscale-tools available. Please " "upgrade the tools package before running 'appscale upgrade'.". format(latest_tools)) master_ip = node_layout.head_node().public_ip upgrade_version_available = cls.get_upgrade_version_available() current_version = RemoteHelper.get_host_appscale_version( master_ip, options.keyname, options.verbose) # Don't run bootstrap if current version is later that the most recent # public one. Covers cases of revoked versions/tags and ensures we won't # try to downgrade the code. if current_version >= upgrade_version_available: AppScaleLogger.log( 'AppScale is already up to date. Skipping code upgrade.') AppScaleLogger.log( 'Running upgrade script to check if any other upgrades are needed.' ) cls.shut_down_appscale_if_running(options) cls.run_upgrade_script(options, node_layout) return cls.shut_down_appscale_if_running(options) cls.upgrade_appscale(options, node_layout)
def test_with_wrong_number_of_disks(self): # suppose that the user has specified two nodes, but only one EBS / PD disk # this should fail. input_yaml = { 'controller' : self.ip_1, 'servers' : [self.ip_2] } options = self.default_options.copy() options['ips'] = input_yaml options['disks'] = { self.ip_1 : 'disk_number_one' } layout = NodeLayout(options) self.assertEquals(False, layout.is_valid())
def test_with_right_number_of_unique_disks(self): # suppose that the user has specified two nodes, and two EBS / PD disks # with different names. This is the desired user behavior. input_yaml = {'controller': self.ip_1, 'servers': [self.ip_2]} options = self.default_options.copy() options['ips'] = input_yaml options['disks'] = { self.ip_1: 'disk_number_one', self.ip_2: 'disk_number_two' } layout = NodeLayout(options) self.assertEquals(True, layout.is_valid()) self.assertEquals('disk_number_one', layout.head_node().disk) self.assertEquals('disk_number_two', layout.other_nodes()[0].disk)
def test_with_login_override(self): # if the user wants to set a login host, make sure that gets set as the # login node's public IP address instead of what we'd normally put in # use a simple deployment so we can get the login node with .head_node() input_yaml_1 = {'controller': self.ip_1, 'servers': [self.ip_2]} options_1 = self.default_options.copy() options_1['ips'] = input_yaml_1 options_1['login_host'] = "www.booscale.com" layout_1 = NodeLayout(options_1) self.assertEquals(True, layout_1.is_valid()) head_node = layout_1.head_node() self.assertEquals(options_1['login_host'], head_node.public_ip)
def test_with_right_number_of_disks_but_not_unique(self): # suppose that the user has specified two nodes, but uses the same name for # both disks. This isn't acceptable. input_yaml = { 'controller' : self.ip_1, 'servers' : [self.ip_2] } options = self.default_options.copy() options['ips'] = input_yaml options['disks'] = { self.ip_1 : 'disk_number_one', self.ip_2 : 'disk_number_one' } layout = NodeLayout(options) self.assertEquals(False, layout.is_valid())
def test_simple_layout_yaml_only(self): # Specifying one controller and one server should be ok input_yaml_1 = {'controller': self.ip_1, 'servers': [self.ip_2]} options_1 = self.default_options.copy() options_1['ips'] = input_yaml_1 layout_1 = NodeLayout(options_1) self.assertEquals(True, layout_1.is_valid()) # Specifying one controller should be ok input_yaml_2 = {'controller': self.ip_1} options_2 = self.default_options.copy() options_2['ips'] = input_yaml_2 layout_2 = NodeLayout(options_2) self.assertEquals(True, layout_2.is_valid()) # Specifying the same IP more than once is not ok input_yaml_3 = {'controller': self.ip_1, 'servers': [self.ip_1]} options_3 = self.default_options.copy() options_3['ips'] = input_yaml_3 layout_3 = NodeLayout(options_3) self.assertEquals(False, layout_3.is_valid()) self.assertEquals(NodeLayout.DUPLICATE_IPS, layout_3.errors()) # Failing to specify a controller is not ok input_yaml_4 = {'servers': [self.ip_1, self.ip_2]} options_4 = self.default_options.copy() options_4['ips'] = input_yaml_4 layout_4 = NodeLayout(options_4) self.assertEquals(False, layout_4.is_valid()) self.assertEquals(NodeLayout.NO_CONTROLLER, layout_4.errors()) # Specifying more than one controller is not ok input_yaml_5 = { 'controller': [self.ip_1, self.ip_2], 'servers': [self.ip_3] } options_5 = self.default_options.copy() options_5['ips'] = input_yaml_5 layout_5 = NodeLayout(options_5) self.assertEquals(False, layout_5.is_valid()) self.assertEquals(NodeLayout.ONLY_ONE_CONTROLLER, layout_5.errors()) # Specifying something other than controller and servers in simple # deployments is not ok input_yaml_6 = { 'controller': self.ip_1, 'servers': [self.ip_2], 'boo': self.ip_3 } options_6 = self.default_options.copy() options_6['ips'] = input_yaml_6 layout_6 = NodeLayout(options_6) self.assertEquals(False, layout_6.is_valid()) self.assertEquals(["The flag boo is not a supported flag"], layout_6.errors())
def upgrade(cls, options): """ Upgrades the deployment to the latest AppScale version. Args: options: A Namespace that has fields for each parameter that can be passed in via the command-line interface. """ node_layout = NodeLayout(options) if not node_layout.is_valid(): raise BadConfigurationException("Your ips_layout is invalid:\n{}".format(node_layout.errors())) latest_tools = APPSCALE_VERSION try: AppScaleLogger.log("Checking if an update is available for appscale-tools") latest_tools = latest_tools_version() except: # Prompt the user if version metadata can't be fetched. if not options.test: response = raw_input( "Unable to check for the latest version of appscale-tools. Would " "you like to continue upgrading anyway? (y/N) " ) if response.lower() not in ["y", "yes"]: raise AppScaleException("Cancelled AppScale upgrade.") if latest_tools > APPSCALE_VERSION: raise AppScaleException( "There is a newer version ({}) of appscale-tools available. Please " "upgrade the tools package before running 'appscale upgrade'.".format(latest_tools) ) master_ip = node_layout.head_node().public_ip upgrade_version_available = cls.get_upgrade_version_available() current_version = RemoteHelper.get_host_appscale_version(master_ip, options.keyname, options.verbose) # Don't run bootstrap if current version is later that the most recent # public one. Covers cases of revoked versions/tags and ensures we won't # try to downgrade the code. if current_version >= upgrade_version_available: AppScaleLogger.log("AppScale is already up to date. Skipping code upgrade.") AppScaleLogger.log("Running upgrade script to check if any other upgrades are needed.") cls.shut_down_appscale_if_running(options) cls.run_upgrade_script(options, node_layout) return cls.shut_down_appscale_if_running(options) cls.upgrade_appscale(options, node_layout)
def test_with_login_override(self): # if the user wants to set a login host, make sure that gets set as the # login node's public IP address instead of what we'd normally put in # use a simple deployment so we can get the login node with .head_node() input_yaml_1 = { 'controller' : self.ip_1, 'servers' : [self.ip_2] } options_1 = self.default_options.copy() options_1['ips'] = input_yaml_1 options_1['login_host'] = "www.booscale.com" layout_1 = NodeLayout(options_1) self.assertEquals(True, layout_1.is_valid()) head_node = layout_1.head_node() self.assertEquals(options_1['login_host'], head_node.public_ip)
def test_with_right_number_of_unique_disks(self): # suppose that the user has specified two nodes, and two EBS / PD disks # with different names. This is the desired user behavior. input_yaml = { 'controller' : self.ip_1, 'servers' : [self.ip_2] } options = self.default_options.copy() options['ips'] = input_yaml options['disks'] = { self.ip_1 : 'disk_number_one', self.ip_2 : 'disk_number_two' } layout = NodeLayout(options) self.assertEquals(True, layout.is_valid()) self.assertEquals('disk_number_one', layout.head_node().disk) self.assertEquals('disk_number_two', layout.other_nodes()[0].disk)
def test_simple_layout_yaml_only(self): # Specifying one controller and one server should be ok input_yaml_1 = { 'controller' : self.ip_1, 'servers' : [self.ip_2] } options_1 = self.default_options.copy() options_1['ips'] = input_yaml_1 layout_1 = NodeLayout(options_1) self.assertEquals(True, layout_1.is_valid()) # Specifying one controller should be ok input_yaml_2 = {'controller' : self.ip_1} options_2 = self.default_options.copy() options_2['ips'] = input_yaml_2 layout_2 = NodeLayout(options_2) self.assertEquals(True, layout_2.is_valid()) # Specifying the same IP more than once is not ok input_yaml_3 = {'controller' : self.ip_1, 'servers' : [self.ip_1]} options_3 = self.default_options.copy() options_3['ips'] = input_yaml_3 layout_3 = NodeLayout(options_3) self.assertEquals(False, layout_3.is_valid()) self.assertEquals(NodeLayout.DUPLICATE_IPS, layout_3.errors()) # Failing to specify a controller is not ok input_yaml_4 = {'servers' : [self.ip_1, self.ip_2]} options_4 = self.default_options.copy() options_4['ips'] = input_yaml_4 layout_4 = NodeLayout(options_4) self.assertEquals(False, layout_4.is_valid()) self.assertEquals(NodeLayout.NO_CONTROLLER, layout_4.errors()) # Specifying more than one controller is not ok input_yaml_5 = {'controller' : [self.ip_1, self.ip_2], 'servers' : [self.ip_3]} options_5 = self.default_options.copy() options_5['ips'] = input_yaml_5 layout_5 = NodeLayout(options_5) self.assertEquals(False, layout_5.is_valid()) self.assertEquals(NodeLayout.ONLY_ONE_CONTROLLER, layout_5.errors()) # Specifying something other than controller and servers in simple # deployments is not ok input_yaml_6 = {'controller' : self.ip_1, 'servers' : [self.ip_2], 'boo' : self.ip_3} options_6 = self.default_options.copy() options_6['ips'] = input_yaml_6 layout_6 = NodeLayout(options_6) self.assertEquals(False, layout_6.is_valid()) self.assertEquals(["The flag boo is not a supported flag"], layout_6.errors())
def run_instances(cls, options): """Starts a new AppScale deployment with the parameters given. Args: options: A Namespace that has fields for each parameter that can be passed in via the command-line interface. Raises: BadConfigurationException: If the user passes in options that are not sufficient to start an AppScale deplyoment (e.g., running on EC2 but not specifying the AMI to use), or if the user provides us contradictory options (e.g., running on EC2 but not specifying EC2 credentials). """ LocalState.make_appscale_directory() LocalState.ensure_appscale_isnt_running(options.keyname, options.force) if options.infrastructure: AppScaleLogger.log("Starting AppScale " + APPSCALE_VERSION + " over the " + options.infrastructure + " cloud.") else: AppScaleLogger.log("Starting AppScale " + APPSCALE_VERSION + " over a virtualized cluster.") my_id = str(uuid.uuid4()) AppScaleLogger.remote_log_tools_state(options, my_id, "started", APPSCALE_VERSION) node_layout = NodeLayout(options) if not node_layout.is_valid(): raise BadConfigurationException("There were errors with your " + \ "placement strategy:\n{0}".format(str(node_layout.errors()))) if not node_layout.is_supported(): AppScaleLogger.warn("Warning: This deployment strategy is not " + \ "officially supported.") public_ip, instance_id = RemoteHelper.start_head_node(options, my_id, node_layout) AppScaleLogger.log("\nPlease wait for AppScale to prepare your machines " + "for use.") # Write our metadata as soon as possible to let users SSH into those # machines via 'appscale ssh' LocalState.update_local_metadata(options, node_layout, public_ip, instance_id) RemoteHelper.copy_local_metadata(public_ip, options.keyname, options.verbose) acc = AppControllerClient(public_ip, LocalState.get_secret_key( options.keyname)) uaserver_host = acc.get_uaserver_host(options.verbose) RemoteHelper.sleep_until_port_is_open(uaserver_host, UserAppClient.PORT, options.verbose) # Update our metadata again so that users can SSH into other boxes that # may have been started. LocalState.update_local_metadata(options, node_layout, public_ip, instance_id) RemoteHelper.copy_local_metadata(public_ip, options.keyname, options.verbose) AppScaleLogger.log("UserAppServer is at {0}".format(uaserver_host)) uaserver_client = UserAppClient(uaserver_host, LocalState.get_secret_key(options.keyname)) if options.admin_user and options.admin_pass: AppScaleLogger.log("Using the provided admin username/password") username, password = options.admin_user, options.admin_pass elif options.test: AppScaleLogger.log("Using default admin username/password") username, password = LocalState.DEFAULT_USER, LocalState.DEFAULT_PASSWORD else: username, password = LocalState.get_credentials() RemoteHelper.create_user_accounts(username, password, uaserver_host, options.keyname) uaserver_client.set_admin_role(username) RemoteHelper.wait_for_machines_to_finish_loading(public_ip, options.keyname) # Finally, update our metadata once we know that all of the machines are # up and have started all their API services. LocalState.update_local_metadata(options, node_layout, public_ip, instance_id) RemoteHelper.copy_local_metadata(public_ip, options.keyname, options.verbose) RemoteHelper.sleep_until_port_is_open(LocalState.get_login_host( options.keyname), RemoteHelper.APP_LOAD_BALANCER_PORT, options.verbose) AppScaleLogger.success("AppScale successfully started!") AppScaleLogger.success("View status information about your AppScale " + \ "deployment at http://{0}/status".format(LocalState.get_login_host( options.keyname))) AppScaleLogger.remote_log_tools_state(options, my_id, "finished", APPSCALE_VERSION)
def run_instances(cls, options): """Starts a new AppScale deployment with the parameters given. Args: options: A Namespace that has fields for each parameter that can be passed in via the command-line interface. Raises: AppControllerException: If the AppController on the head node crashes. When this occurs, the message in the exception contains the reason why the AppController crashed. BadConfigurationException: If the user passes in options that are not sufficient to start an AppScale deployment (e.g., running on EC2 but not specifying the AMI to use), or if the user provides us contradictory options (e.g., running on EC2 but not specifying EC2 credentials). """ LocalState.make_appscale_directory() LocalState.ensure_appscale_isnt_running(options.keyname, options.force) if options.infrastructure: if not options.disks and not options.test and not options.force: LocalState.ensure_user_wants_to_run_without_disks() AppScaleLogger.log( "Starting AppScale " + APPSCALE_VERSION + " over the " + options.infrastructure + " cloud." ) else: AppScaleLogger.log("Starting AppScale " + APPSCALE_VERSION + " over a virtualized cluster.") my_id = str(uuid.uuid4()) AppScaleLogger.remote_log_tools_state(options, my_id, "started", APPSCALE_VERSION) node_layout = NodeLayout(options) if not node_layout.is_valid(): raise BadConfigurationException( "There were errors with your " + "placement strategy:\n{0}".format(str(node_layout.errors())) ) public_ip, instance_id = RemoteHelper.start_head_node(options, my_id, node_layout) AppScaleLogger.log( "\nPlease wait for AppScale to prepare your machines " + "for use. This can take few minutes." ) # Write our metadata as soon as possible to let users SSH into those # machines via 'appscale ssh'. LocalState.update_local_metadata(options, node_layout, public_ip, instance_id) RemoteHelper.copy_local_metadata(public_ip, options.keyname, options.verbose) acc = AppControllerClient(public_ip, LocalState.get_secret_key(options.keyname)) # Let's now wait till the server is initialized. while not acc.is_initialized(): AppScaleLogger.log("Waiting for head node to initialize...") # This can take some time in particular the first time around, since # we will have to initialize the database. time.sleep(cls.SLEEP_TIME * 3) # Now let's make sure the UserAppServer is fully initialized. uaserver_client = UserAppClient(public_ip, LocalState.get_secret_key(options.keyname)) try: # We don't need to have any exception information here: we do expect # some anyway while the UserAppServer is coming up. uaserver_client.does_user_exist("non-existent-user", True) except Exception as exception: AppScaleLogger.log("UserAppServer not ready yet. Retrying ...") time.sleep(cls.SLEEP_TIME) # Update our metadata again so that users can SSH into other boxes that # may have been started. LocalState.update_local_metadata(options, node_layout, public_ip, instance_id) RemoteHelper.copy_local_metadata(public_ip, options.keyname, options.verbose) if options.admin_user and options.admin_pass: AppScaleLogger.log("Using the provided admin username/password") username, password = options.admin_user, options.admin_pass elif options.test: AppScaleLogger.log("Using default admin username/password") username, password = LocalState.DEFAULT_USER, LocalState.DEFAULT_PASSWORD else: username, password = LocalState.get_credentials() RemoteHelper.create_user_accounts(username, password, public_ip, options.keyname, options.clear_datastore) uaserver_client.set_admin_role(username) RemoteHelper.wait_for_machines_to_finish_loading(public_ip, options.keyname) # Finally, update our metadata once we know that all of the machines are # up and have started all their API services. LocalState.update_local_metadata(options, node_layout, public_ip, instance_id) RemoteHelper.copy_local_metadata(public_ip, options.keyname, options.verbose) RemoteHelper.sleep_until_port_is_open( LocalState.get_login_host(options.keyname), RemoteHelper.APP_DASHBOARD_PORT, options.verbose ) AppScaleLogger.success("AppScale successfully started!") AppScaleLogger.success( "View status information about your AppScale " + "deployment at http://{0}:{1}/status".format( LocalState.get_login_host(options.keyname), RemoteHelper.APP_DASHBOARD_PORT ) ) AppScaleLogger.remote_log_tools_state(options, my_id, "finished", APPSCALE_VERSION)
def run_instances(cls, options): """Starts a new AppScale deployment with the parameters given. Args: options: A Namespace that has fields for each parameter that can be passed in via the command-line interface. Raises: AppControllerException: If the AppController on the head node crashes. When this occurs, the message in the exception contains the reason why the AppController crashed. BadConfigurationException: If the user passes in options that are not sufficient to start an AppScale deployment (e.g., running on EC2 but not specifying the AMI to use), or if the user provides us contradictory options (e.g., running on EC2 but not specifying EC2 credentials). """ LocalState.make_appscale_directory() LocalState.ensure_appscale_isnt_running(options.keyname, options.force) if options.infrastructure: if not options.disks and not options.test and not options.force: LocalState.ensure_user_wants_to_run_without_disks() reduced_version = '.'.join(x for x in APPSCALE_VERSION.split('.')[:2]) AppScaleLogger.log("Starting AppScale " + reduced_version) my_id = str(uuid.uuid4()) AppScaleLogger.remote_log_tools_state(options, my_id, "started", APPSCALE_VERSION) node_layout = NodeLayout(options) if not node_layout.is_valid(): raise BadConfigurationException("There were errors with your " + \ "placement strategy:\n{0}".format(str(node_layout.errors()))) head_node = node_layout.head_node() # Start VMs in cloud via cloud agent. if options.infrastructure: instance_ids, public_ips, private_ips = RemoteHelper.start_all_nodes( options, len(node_layout.nodes)) AppScaleLogger.log("\nPlease wait for AppScale to prepare your machines " "for use. This can take few minutes.") # Set newly obtained node layout info for this deployment. for i, _ in enumerate(instance_ids): node_layout.nodes[i].public_ip = public_ips[i] node_layout.nodes[i].private_ip = private_ips[i] node_layout.nodes[i].instance_id = instance_ids[i] # Enables root logins and SSH access on the head node. RemoteHelper.enable_root_ssh(options, head_node.public_ip) AppScaleLogger.verbose("Node Layout: {}".format(node_layout.to_list()), options.verbose) # Ensure all nodes are compatible. RemoteHelper.ensure_machine_is_compatible( head_node.public_ip, options.keyname, options.verbose) # Use rsync to move custom code into the deployment. if options.scp: AppScaleLogger.log("Copying over local copy of AppScale from {0}". format(options.scp)) RemoteHelper.rsync_files(head_node.public_ip, options.keyname, options.scp, options.verbose) # Start services on head node. RemoteHelper.start_head_node(options, my_id, node_layout) # Write deployment metadata to disk (facilitates SSH operations, etc.) db_master = node_layout.db_master().private_ip head_node = node_layout.head_node().public_ip LocalState.update_local_metadata(options, db_master, head_node) # Copy the locations.json to the head node RemoteHelper.copy_local_metadata(node_layout.head_node().public_ip, options.keyname, options.verbose) # Wait for services on head node to start. secret_key = LocalState.get_secret_key(options.keyname) acc = AppControllerClient(head_node, secret_key) try: while not acc.is_initialized(): AppScaleLogger.log('Waiting for head node to initialize...') # This can take some time in particular the first time around, since # we will have to initialize the database. time.sleep(cls.SLEEP_TIME*3) except socket.error as socket_error: AppScaleLogger.warn('Unable to initialize AppController: {}'. format(socket_error.message)) message = RemoteHelper.collect_appcontroller_crashlog( head_node, options.keyname, options.verbose) raise AppControllerException(message) # Set up admin account. try: # We don't need to have any exception information here: we do expect # some anyway while the UserAppServer is coming up. acc.does_user_exist("non-existent-user", True) except Exception: AppScaleLogger.log('UserAppServer not ready yet. Retrying ...') time.sleep(cls.SLEEP_TIME) if options.admin_user and options.admin_pass: AppScaleLogger.log("Using the provided admin username/password") username, password = options.admin_user, options.admin_pass elif options.test: AppScaleLogger.log("Using default admin username/password") username, password = LocalState.DEFAULT_USER, LocalState.DEFAULT_PASSWORD else: username, password = LocalState.get_credentials() RemoteHelper.create_user_accounts(username, password, head_node, options.keyname) acc.set_admin_role(username, 'true', cls.ADMIN_CAPABILITIES) # Wait for machines to finish loading and AppScale Dashboard to be deployed. RemoteHelper.wait_for_machines_to_finish_loading(head_node, options.keyname) RemoteHelper.sleep_until_port_is_open(LocalState.get_login_host( options.keyname), RemoteHelper.APP_DASHBOARD_PORT, options.verbose) AppScaleLogger.success("AppScale successfully started!") AppScaleLogger.success("View status information about your AppScale " + \ "deployment at http://{0}:{1}".format(LocalState.get_login_host( options.keyname), RemoteHelper.APP_DASHBOARD_PORT)) AppScaleLogger.remote_log_tools_state(options, my_id, "finished", APPSCALE_VERSION)
def run_instances(cls, options): """Starts a new AppScale deployment with the parameters given. Args: options: A Namespace that has fields for each parameter that can be passed in via the command-line interface. Raises: AppControllerException: If the AppController on the head node crashes. When this occurs, the message in the exception contains the reason why the AppController crashed. BadConfigurationException: If the user passes in options that are not sufficient to start an AppScale deployment (e.g., running on EC2 but not specifying the AMI to use), or if the user provides us contradictory options (e.g., running on EC2 but not specifying EC2 credentials). """ LocalState.make_appscale_directory() LocalState.ensure_appscale_isnt_running(options.keyname, options.force) if options.infrastructure: if not options.disks and not options.test and not options.force: LocalState.ensure_user_wants_to_run_without_disks() AppScaleLogger.log("Starting AppScale " + APPSCALE_VERSION + " over the " + options.infrastructure + " cloud.") else: AppScaleLogger.log("Starting AppScale " + APPSCALE_VERSION + " over a virtualized cluster.") my_id = str(uuid.uuid4()) AppScaleLogger.remote_log_tools_state(options, my_id, "started", APPSCALE_VERSION) node_layout = NodeLayout(options) if not node_layout.is_valid(): raise BadConfigurationException("There were errors with your " + \ "placement strategy:\n{0}".format(str(node_layout.errors()))) if not node_layout.is_supported(): AppScaleLogger.warn("Warning: This deployment strategy is not " + \ "officially supported.") public_ip, instance_id = RemoteHelper.start_head_node( options, my_id, node_layout) AppScaleLogger.log( "\nPlease wait for AppScale to prepare your machines " + "for use.") # Write our metadata as soon as possible to let users SSH into those # machines via 'appscale ssh' LocalState.update_local_metadata(options, node_layout, public_ip, instance_id) RemoteHelper.copy_local_metadata(public_ip, options.keyname, options.verbose) acc = AppControllerClient(public_ip, LocalState.get_secret_key(options.keyname)) try: uaserver_host = acc.get_uaserver_host(options.verbose) except Exception: message = RemoteHelper.collect_appcontroller_crashlog( public_ip, options.keyname, options.verbose) raise AppControllerException(message) RemoteHelper.sleep_until_port_is_open(uaserver_host, UserAppClient.PORT, options.verbose) # Update our metadata again so that users can SSH into other boxes that # may have been started. LocalState.update_local_metadata(options, node_layout, public_ip, instance_id) RemoteHelper.copy_local_metadata(public_ip, options.keyname, options.verbose) AppScaleLogger.log("UserAppServer is at {0}".format(uaserver_host)) uaserver_client = UserAppClient( uaserver_host, LocalState.get_secret_key(options.keyname)) if options.admin_user and options.admin_pass: AppScaleLogger.log("Using the provided admin username/password") username, password = options.admin_user, options.admin_pass elif options.test: AppScaleLogger.log("Using default admin username/password") username, password = LocalState.DEFAULT_USER, LocalState.DEFAULT_PASSWORD else: username, password = LocalState.get_credentials() RemoteHelper.create_user_accounts(username, password, uaserver_host, options.keyname, options.clear_datastore) uaserver_client.set_admin_role(username) RemoteHelper.wait_for_machines_to_finish_loading( public_ip, options.keyname) # Finally, update our metadata once we know that all of the machines are # up and have started all their API services. LocalState.update_local_metadata(options, node_layout, public_ip, instance_id) RemoteHelper.copy_local_metadata(public_ip, options.keyname, options.verbose) RemoteHelper.sleep_until_port_is_open( LocalState.get_login_host(options.keyname), RemoteHelper.APP_DASHBOARD_PORT, options.verbose) AppScaleLogger.success("AppScale successfully started!") AppScaleLogger.success("View status information about your AppScale " + \ "deployment at http://{0}:{1}/status".format(LocalState.get_login_host( options.keyname), RemoteHelper.APP_DASHBOARD_PORT)) AppScaleLogger.remote_log_tools_state(options, my_id, "finished", APPSCALE_VERSION)
def run_instances(cls, options): """Starts a new AppScale deployment with the parameters given. Args: options: A Namespace that has fields for each parameter that can be passed in via the command-line interface. Raises: AppControllerException: If the AppController on the head node crashes. When this occurs, the message in the exception contains the reason why the AppController crashed. BadConfigurationException: If the user passes in options that are not sufficient to start an AppScale deployment (e.g., running on EC2 but not specifying the AMI to use), or if the user provides us contradictory options (e.g., running on EC2 but not specifying EC2 credentials). """ LocalState.make_appscale_directory() LocalState.ensure_appscale_isnt_running(options.keyname, options.force) if options.infrastructure: if not options.disks and not options.test and not options.force: LocalState.ensure_user_wants_to_run_without_disks() AppScaleLogger.log("Starting AppScale " + APPSCALE_VERSION + " over the " + options.infrastructure + " cloud.") else: AppScaleLogger.log("Starting AppScale " + APPSCALE_VERSION + " over a virtualized cluster.") my_id = str(uuid.uuid4()) AppScaleLogger.remote_log_tools_state(options, my_id, "started", APPSCALE_VERSION) node_layout = NodeLayout(options) if not node_layout.is_valid(): raise BadConfigurationException("There were errors with your " + \ "placement strategy:\n{0}".format(str(node_layout.errors()))) public_ip, instance_id = RemoteHelper.start_head_node( options, my_id, node_layout) AppScaleLogger.log( "\nPlease wait for AppScale to prepare your machines " + "for use. This can take few minutes.") # Write our metadata as soon as possible to let users SSH into those # machines via 'appscale ssh'. LocalState.update_local_metadata(options, node_layout, public_ip, instance_id) RemoteHelper.copy_local_metadata(public_ip, options.keyname, options.verbose) acc = AppControllerClient(public_ip, LocalState.get_secret_key(options.keyname)) # Let's now wait till the server is initialized. while not acc.is_initialized(): AppScaleLogger.log('Waiting for head node to initialize...') # This can take some time in particular the first time around, since # we will have to initialize the database. time.sleep(cls.SLEEP_TIME * 3) try: # We don't need to have any exception information here: we do expect # some anyway while the UserAppServer is coming up. acc.does_user_exist("non-existent-user", True) except Exception as exception: AppScaleLogger.log('UserAppServer not ready yet. Retrying ...') time.sleep(cls.SLEEP_TIME) # Update our metadata again so that users can SSH into other boxes that # may have been started. LocalState.update_local_metadata(options, node_layout, public_ip, instance_id) RemoteHelper.copy_local_metadata(public_ip, options.keyname, options.verbose) if options.admin_user and options.admin_pass: AppScaleLogger.log("Using the provided admin username/password") username, password = options.admin_user, options.admin_pass elif options.test: AppScaleLogger.log("Using default admin username/password") username, password = LocalState.DEFAULT_USER, LocalState.DEFAULT_PASSWORD else: username, password = LocalState.get_credentials() RemoteHelper.create_user_accounts(username, password, public_ip, options.keyname, options.clear_datastore) acc.set_admin_role(username, 'true', cls.ADMIN_CAPABILITIES) RemoteHelper.wait_for_machines_to_finish_loading( public_ip, options.keyname) # Finally, update our metadata once we know that all of the machines are # up and have started all their API services. LocalState.update_local_metadata(options, node_layout, public_ip, instance_id) RemoteHelper.copy_local_metadata(public_ip, options.keyname, options.verbose) RemoteHelper.sleep_until_port_is_open( LocalState.get_login_host(options.keyname), RemoteHelper.APP_DASHBOARD_PORT, options.verbose) AppScaleLogger.success("AppScale successfully started!") AppScaleLogger.success("View status information about your AppScale " + \ "deployment at http://{0}:{1}/status".format(LocalState.get_login_host( options.keyname), RemoteHelper.APP_DASHBOARD_PORT)) AppScaleLogger.remote_log_tools_state(options, my_id, "finished", APPSCALE_VERSION)
def run_instances(cls, options): """Starts a new AppScale deployment with the parameters given. Args: options: A Namespace that has fields for each parameter that can be passed in via the command-line interface. Raises: AppControllerException: If the AppController on the head node crashes. When this occurs, the message in the exception contains the reason why the AppController crashed. BadConfigurationException: If the user passes in options that are not sufficient to start an AppScale deployment (e.g., running on EC2 but not specifying the AMI to use), or if the user provides us contradictory options (e.g., running on EC2 but not specifying EC2 credentials). """ LocalState.make_appscale_directory() LocalState.ensure_appscale_isnt_running(options.keyname, options.force) if options.infrastructure: if not options.disks and not options.test and not options.force: LocalState.ensure_user_wants_to_run_without_disks() reduced_version = ".".join(x for x in APPSCALE_VERSION.split(".")[:2]) AppScaleLogger.log("Starting AppScale " + reduced_version) my_id = str(uuid.uuid4()) AppScaleLogger.remote_log_tools_state(options, my_id, "started", APPSCALE_VERSION) node_layout = NodeLayout(options) if not node_layout.is_valid(): raise BadConfigurationException( "There were errors with your " + "placement strategy:\n{0}".format(str(node_layout.errors())) ) head_node = node_layout.head_node() # Start VMs in cloud via cloud agent. if options.infrastructure: instance_ids, public_ips, private_ips = RemoteHelper.start_all_nodes(options, len(node_layout.nodes)) AppScaleLogger.log( "\nPlease wait for AppScale to prepare your machines " "for use. This can take few minutes." ) # Set newly obtained node layout info for this deployment. for i, _ in enumerate(instance_ids): node_layout.nodes[i].public_ip = public_ips[i] node_layout.nodes[i].private_ip = private_ips[i] node_layout.nodes[i].instance_id = instance_ids[i] # Enables root logins and SSH access on the head node. RemoteHelper.enable_root_ssh(options, head_node.public_ip) AppScaleLogger.verbose("Node Layout: {}".format(node_layout.to_list()), options.verbose) # Ensure all nodes are compatible. RemoteHelper.ensure_machine_is_compatible(head_node.public_ip, options.keyname, options.verbose) # Use rsync to move custom code into the deployment. if options.scp: AppScaleLogger.log("Copying over local copy of AppScale from {0}".format(options.scp)) RemoteHelper.rsync_files(head_node.public_ip, options.keyname, options.scp, options.verbose) # Start services on head node. RemoteHelper.start_head_node(options, my_id, node_layout) # Write deployment metadata to disk (facilitates SSH operations, etc.) db_master = node_layout.db_master().private_ip head_node = node_layout.head_node().public_ip LocalState.update_local_metadata(options, db_master, head_node) # Copy the locations.json to the head node RemoteHelper.copy_local_metadata(node_layout.head_node().public_ip, options.keyname, options.verbose) # Wait for services on head node to start. secret_key = LocalState.get_secret_key(options.keyname) acc = AppControllerClient(head_node, secret_key) try: while not acc.is_initialized(): AppScaleLogger.log("Waiting for head node to initialize...") # This can take some time in particular the first time around, since # we will have to initialize the database. time.sleep(cls.SLEEP_TIME * 3) except socket.error as socket_error: AppScaleLogger.warn("Unable to initialize AppController: {}".format(socket_error.message)) message = RemoteHelper.collect_appcontroller_crashlog(head_node, options.keyname, options.verbose) raise AppControllerException(message) # Set up admin account. try: # We don't need to have any exception information here: we do expect # some anyway while the UserAppServer is coming up. acc.does_user_exist("non-existent-user", True) except Exception: AppScaleLogger.log("UserAppServer not ready yet. Retrying ...") time.sleep(cls.SLEEP_TIME) if options.admin_user and options.admin_pass: AppScaleLogger.log("Using the provided admin username/password") username, password = options.admin_user, options.admin_pass elif options.test: AppScaleLogger.log("Using default admin username/password") username, password = LocalState.DEFAULT_USER, LocalState.DEFAULT_PASSWORD else: username, password = LocalState.get_credentials() RemoteHelper.create_user_accounts(username, password, head_node, options.keyname) acc.set_admin_role(username, "true", cls.ADMIN_CAPABILITIES) # Wait for machines to finish loading and AppScale Dashboard to be deployed. RemoteHelper.wait_for_machines_to_finish_loading(head_node, options.keyname) RemoteHelper.sleep_until_port_is_open( LocalState.get_login_host(options.keyname), RemoteHelper.APP_DASHBOARD_PORT, options.verbose ) AppScaleLogger.success("AppScale successfully started!") AppScaleLogger.success( "View status information about your AppScale " + "deployment at http://{0}:{1}".format( LocalState.get_login_host(options.keyname), RemoteHelper.APP_DASHBOARD_PORT ) ) AppScaleLogger.remote_log_tools_state(options, my_id, "finished", APPSCALE_VERSION)