示例#1
0
    def report_asset(self):
        obj = info_collection.InfoCollection()
        asset_data = obj.collect()
        asset_id = self.load_asset_id(asset_data["sn"])
        if asset_id:  #reported to server before
            asset_data["asset_id"] = asset_id
            post_url = "asset_report"
        else:  #first time report to server
            '''report to another url,this will put the asset into approval waiting zone, when the asset is approved ,this request returns
            asset's ID'''

            asset_data["asset_id"] = None
            post_url = "asset_report_with_no_id"

        data = {"asset_data": json.dumps(asset_data)}
        response = self.__submit_data(post_url, data, method="post")
        if "asset_id" in response:
            self.__update_asset_id(response["asset_id"])

        self.log_record(response)
示例#2
0
 def collect_data(self):
     obj = info_collection.InfoCollection()
     asset_data = obj.collect()
     print asset_data
示例#3
0
 def collect_data(self):
     """收集硬件信息"""
     obj = info_collection.InfoCollection()
     asset_data = obj.collect()