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 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)