当前位置: 首页>>代码示例>>Python>>正文


Python CShowParser.parse_file_copy方法代码示例

本文整理汇总了Python中CShowParser.CShowParser.parse_file_copy方法的典型用法代码示例。如果您正苦于以下问题:Python CShowParser.parse_file_copy方法的具体用法?Python CShowParser.parse_file_copy怎么用?Python CShowParser.parse_file_copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CShowParser.CShowParser的用法示例。


在下文中一共展示了CShowParser.parse_file_copy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load_platform_image

# 需要导入模块: from CShowParser import CShowParser [as 别名]
# 或者: from CShowParser.CShowParser import parse_file_copy [as 别名]
    def load_platform_image(self, img_filename, external_tftp_config=None):
        """ load_platform_image(self, img_filename, external_tftp_config) -> None

        Parameters
        ----------
        external_tftp_config : dict
            A path to external tftp config file other than using the one defined in the instance.
        img_filename : str
            image name to be saved into the platforms drive.

        This method loads the configured image into the platform's harddisk (unless it is already loaded),
        and sets that image to be the boot_image of the platform.
        """
        if not self.check_image_existence(img_filename):  # check if this image isn't already saved in platform
            # tmp_tftp_config = external_tftp_config if external_tftp_config is not None else self.tftp_cfg

            if self.config_history["tftp_server_config"]:  # make sure a TFTP configuration has been loaded
                cache = CCommandCache()
                if self.running_image is None:
                    self.get_running_image_details()

                command = "copy tftp://{tftp_ip}/{img_path}/{image} harddisk:".format(
                    tftp_ip=self.tftp_cfg["ip_address"], img_path=self.tftp_cfg["images_path"], image=img_filename
                )
                cache.add("EXEC", [command, "\r", "\r"])

                progress_thread = CProgressDisp.ProgressThread(
                    notifyMessage="Copying image via tftp, this may take a while...\n"
                )
                progress_thread.start()

                response = self.cmd_link.run_single_command(cache, timeout=900, read_until=["\?", "\#"])
                print("RESPONSE:")
                print(response)
                progress_thread.join()
                copy_ok = CShowParser.parse_file_copy(response)

                if not copy_ok:
                    raise UserWarning(
                        "Image file loading failed. Please make sure the accessed image exists and has read privileges"
                    )
            else:
                raise UserWarning(
                    "TFTP configuration is not available. Please make sure a valid TFTP configuration has been provided"
                )
开发者ID:chetangaonker,项目名称:trex-core,代码行数:47,代码来源:CPlatform.py


注:本文中的CShowParser.CShowParser.parse_file_copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。