Example #1
0
File: agent.py Project: nictuku/nwu
    def set_repositories(self, account, remote_host, repositories):
        """ Set new repository list. """
        c = self._get_computer_from_account(account)

        if type(repositories) != list:
            raise InvalidParamsFault('set_repositories')

        delete_all(c.repositories)

        for r in repositories:
            if type(r) != dict or not 'filename' in r or not 'type' in r \
                    or not 'uri' in r or not 'distribution' in r \
                    or not 'components' in r:
                raise InvalidParamsFault('set_repositories')
            filename = r['filename']
            type = r['type']
            uri = r['uri']
            dist = r['distribution']
            components = r['components']
            
            repository = Repositories(filename=filename, type=type, uri=uri,
                                      distribution=dist, components=components)
            repository.save()
            repository.flush()
    
        self._increment_tables_version('repositories')
Example #2
0
File: agent.py Project: nictuku/nwu
    def wipe_update_candidates(self, account, remote_host):
        """ Remove all entries from update_candidates table and reset table
        version.
        """
        c = self._get_computer_from_account(account)

        delete_all(c.update_candidates)

        self._delete_tables_version(c, 'update_candidates')
Example #3
0
File: agent.py Project: nictuku/nwu
    def wipe_repositories(self, account, remote_host):
        """ Remove all entries from repositories table and reset
        table version.
        """
        
        c = self._get_computer_from_account(account)

        delete_all(c.repositories.delete)

        self._delete_tables_version(c, 'repositories')
Example #4
0
File: agent.py Project: nictuku/nwu
    def wipe_current_packages(self, account, remote_host):
        """ Remove all entries from current_packages table and reset
        table version.
        """

        c = self._get_computer_from_account(account)

        delete_all(c.current_packages)

        self._delete_tables_version(c, 'current_packages')
Example #5
0
File: agent.py Project: nictuku/nwu
    def set_update_candidates(self, account, remote_host, update_candidates):
        """ Remove old update candidates and set new ones. """
        c = self._get_computer_from_account(account)

        delete_all(c.update_candidates)

        if type(update_candidates) != list:
            raise InvalidParamsFault('set_update_candidates')

        for uc in update_candidates:
            if type(uc) != dict or not 'name' in uc or not 'version' in uc:
                raise InvalidParamsFault('set_update_candidates')

            name = c['name']
            version = c['version']
            u = UpdateCandidates(computer=c, name=name, version=version)
            u.save()
            u.flush()