Slide 16
Slide 16 text
Insights Client (collect_and_output)
/usr/bin/insights-client
/usr/bin/insights-client-run
/etc/insights-client/
/etc/insights-client/rpm.egg
HTTPS アップロード
(PUT)
insights-core/insights/client/connection.py
------------------------
"""
Module handling HTTP Requests and Connection Diagnostics
"""
from __future__ import print_function
from __future__ import absolute_import
import requests
import os
--------------
Do an HTTPS upload of the archive
'''
file_name = os.path.basename(data_collected)
try:
from insights.contrib import magic
m = magic.open(magic.MAGIC_MIME)
m.load()
mime_type = m.file(data_collected)
except ImportError:
magic = None
logger.debug('python-magic not installed, using backup function...')
from .utilities import magic_plan_b
mime_type = magic_plan_b(data_collected)
files = {
'file': (file_name, open(data_collected, 'rb'), mime_type)}
if self.config.analyze_container:
logger.debug('Uploading container, image, mountpoint or tarfile.')
upload_url = self.upload_url
else:
logger.debug('Uploading a host.')
upload_url = self.upload_url + '/' + generate_machine_id()
logger.debug("Uploading %s to %s", data_collected, upload_url)
headers = {'x-rh-collection-time': str(duration)}
net_logger.info("POST %s", upload_url)