def sync_scripts(self, plugins): tasks = [] for plugin in plugins: uids = get_uids_for_tasks(self.nodes, plugin.tasks) if not uids: continue tasks.append( self.serialize_task( plugin, {}, templates.make_sync_scripts_task( uids, plugin.master_scripts_path(self.cluster), plugin.slaves_scripts_path))) return tasks
def sync_scripts(self, plugins): tasks = [] for plugin in plugins: uids = get_uids_for_tasks(self.nodes, plugin.tasks) if not uids: continue tasks.append( self.serialize_task( plugin, templates.make_sync_scripts_task( uids, plugin.master_scripts_path(self.cluster), plugin.slaves_scripts_path))) return tasks
def _get_node_uids_for_plugin_tasks(self, plugin): # TODO(aroma): remove concatenation of tasks when unified way of # processing will be introduced for deployment tasks and existing # plugin tasks tasks_to_process = plugin.tasks + plugin.deployment_tasks uids = get_uids_for_tasks(self.nodes, tasks_to_process) # NOTE(aroma): pre-deployment tasks should not be executed on # master node because in some cases it leads to errors due to # commands need to be run are not compatible with master node # OS (CentOS). E.g. of such situation - create repository # executes `apt-get update` which fails on CentOS if consts.MASTER_ROLE in uids: uids.remove(consts.MASTER_ROLE) return uids
def create_repositories(self, plugins): operating_system = self.cluster.release.operating_system repo_tasks = [] for plugin in plugins: uids = get_uids_for_tasks(self.nodes, plugin.tasks) # If there are no nodes for tasks execution # or if there are no files in repository if not uids or not plugin.repo_files(self.cluster): continue if operating_system == consts.RELEASE_OS.centos: repo = self.get_centos_repo(plugin) repo_tasks.append( self.serialize_task( plugin, templates.make_centos_repo_task(uids, repo))) elif operating_system == consts.RELEASE_OS.ubuntu: repo = self.get_ubuntu_repo(plugin) repo_tasks.append( self.serialize_task( plugin, templates.make_ubuntu_sources_task(uids, repo))) # do not add preferences task to task list if we can't # complete it (e.g. can't retrieve or parse Release file) task = self.serialize_task( plugin, templates.make_ubuntu_preferences_task(uids, repo)) if task is not None: repo_tasks.append(task) # apt-get update executed after every additional source.list # to be able understand what plugin source.list caused error repo_tasks.append( self.serialize_task( plugin, templates.make_apt_update_task(uids))) else: raise errors.InvalidOperatingSystem( 'Operating system {0} is invalid'.format(operating_system)) return repo_tasks
def create_repositories(self, plugins): operating_system = self.cluster.release.operating_system repo_tasks = [] for plugin in plugins: uids = get_uids_for_tasks(self.nodes, plugin.tasks) # If there are no nodes for tasks execution # or if there are no files in repository if not uids or not plugin.repo_files(self.cluster): continue if operating_system == consts.RELEASE_OS.centos: repo = self.get_centos_repo(plugin) repo_tasks.append( self.serialize_task( plugin, templates.make_centos_repo_task(uids, repo))) elif operating_system == consts.RELEASE_OS.ubuntu: repo = self.get_ubuntu_repo(plugin) repo_tasks.append( self.serialize_task( plugin, templates.make_ubuntu_sources_task(uids, repo))) # do not add preferences task to task list if we can't # complete it (e.g. can't retrieve or parse Release file) task = templates.make_ubuntu_preferences_task(uids, repo) if task is not None: repo_tasks.append(self.serialize_task(plugin, task)) # apt-get update executed after every additional source.list # to be able understand what plugin source.list caused error repo_tasks.append( self.serialize_task(plugin, templates.make_apt_update_task(uids))) else: raise errors.InvalidOperatingSystem( 'Operating system {0} is invalid'.format(operating_system)) return repo_tasks
def create_repositories(self, plugins): operating_system = self.cluster.release.operating_system repo_tasks = [] for plugin in plugins: uids = get_uids_for_tasks(self.nodes, plugin.tasks) # If there are not nodes for tasks execution # or if there are no files in repository if not uids or not plugin.repo_files(self.cluster): continue if operating_system == consts.RELEASE_OS.centos: repo_tasks.append( self.serialize_task( plugin, {}, templates.make_centos_repo_task( plugin.full_name, plugin.repo_url(self.cluster), uids))) elif operating_system == consts.RELEASE_OS.ubuntu: repo_tasks.append( self.serialize_task( plugin, {}, templates.make_multiversion_ubuntu( plugin.full_name, plugin.repo_url(self.cluster), uids))) #apt-get upgrade executed after every additional source.list #to be able understand what plugin source.list caused error repo_tasks.append( self.serialize_task( plugin, {}, templates.make_apt_update_task(uids))) else: raise errors.InvalidOperatingSystem( 'Operating system {0} is invalid'.format(operating_system)) return repo_tasks