Example #1
0
    def run(self, connection, max_end_time):
        connection = super().run(connection, max_end_time)
        # this is the device namespace - the lxc namespace is not accessible
        lxc_name = None
        protocol = [
            protocol for protocol in self.job.protocols
            if protocol.name == LxcProtocol.name
        ][0]
        if protocol:
            lxc_name = protocol.lxc_name
        if not lxc_name:
            raise JobError(
                "Erroneous lxc url '%s' without protocol %s" % self.url,
                LxcProtocol.name)

        fname = os.path.basename(self.url.path)
        lxc_home = lava_lxc_home(lxc_name, self.job.parameters['dispatcher'])
        file_path = os.path.join(lxc_home, fname)
        self.logger.debug("Found '%s' matching '%s'", file_path, fname)
        if os.path.exists(file_path):
            self.set_namespace_data(action='download-action',
                                    label=self.key,
                                    key='file',
                                    value=file_path)
        else:
            raise JobError("Resource unavailable: %s" % self.url.path)
        return connection
Example #2
0
    def run(self, connection, max_end_time, args=None):
        connection = super(LxcDownloadAction, self).run(connection,
                                                        max_end_time, args)
        # this is the device namespace - the lxc namespace is not accessible
        lxc_name = None
        protocol = [protocol for protocol in self.job.protocols if protocol.name == LxcProtocol.name][0]
        if protocol:
            lxc_name = protocol.lxc_name
        if not lxc_name:
            raise JobError("Erroneous lxc url '%s' without protocol %s" %
                           self.url, LxcProtocol.name)

        fname = os.path.basename(self.url.path)
        lxc_home = lava_lxc_home(lxc_name, self.job.parameters['dispatcher'])
        file_path = os.path.join(lxc_home, fname)
        self.logger.debug("Found '%s' matching '%s'", file_path, fname)
        if os.path.exists(file_path):
            self.set_namespace_data(action='download-action', label=self.key,
                                    key='file', value=file_path)
        else:
            raise JobError("Resource unavailable: %s" % self.url.path)
        return connection