RedHatInsights / insights-core

Insights Core is a data collection and processing framework used by Red Hat Insights
https://cloud.redhat.com/insights
Apache License 2.0
153 stars 181 forks source link

Client Crashes on Fedora 26 #706

Closed SteveHNH closed 6 years ago

SteveHNH commented 7 years ago
Metadata collection finished.
Data collection complete. Elapsed time: 0.554159
Writing insights.log to archive...
Tar File: /var/tmp/_YGwUY/insights-t470-20170801175119.tar.gz
Deleting: /var/tmp/W5cQkO/insights-t470-20170801175119
Tar File Size: 286137
Uploading Insights data for t470, this may take a few minutes
Found /etc/insights-client/machine-id
Uploading /var/tmp/_YGwUY/insights-t470-20170801175119.tar.gz to https://cert-api.access.redhat.com/r/insights/uploads/3ae8ca63-be13-4e6c-9873-5ca23b7d3ef4
['Traceback (most recent call last):\n', '  File "/bin/insights-client", line 11, in <module>\n    load_entry_point(\'insights-client==2.0.5\', \'console_scripts\', \'insights-client\')()\n', '  File "/usr/lib/python2.7/site-packages/insights_client/__init__.py", line 723, in _main\n    rc = collect_data_and_upload()\n', '  File "/usr/lib/python2.7/site-packages/insights_client/__init__.py", line 618, in collect_data_and_upload\n    rc = _do_upload(pconn, full_tar_file, logging_name, collection_duration)\n', '  File "/usr/lib/python2.7/site-packages/insights_client/__init__.py", line 636, in _do_upload\n    docker_group=InsightsClient.options.container_mode))\n', '  File "/usr/lib/python2.7/site-packages/insights_client/connection.py", line 755, in upload_archive\n    upload = self.session.post(upload_url, files=files, headers=headers)\n', '  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 535, in post\n    return self.request(\'POST\', url, data=data, json=json, **kwargs)\n', '  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 474, in request\n    prep = self.prepare_request(req)\n', '  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 407, in prepare_request\n    hooks=merge_hooks(request.hooks, self.hooks),\n', '  File "/usr/lib/python2.7/site-packages/requests/models.py", line 303, in prepare\n    self.prepare_headers(headers)\n', '  File "/usr/lib/python2.7/site-packages/requests/models.py", line 443, in prepare_headers\n    check_header_validity(header)\n', '  File "/usr/lib/python2.7/site-packages/requests/utils.py", line 796, in check_header_validity\n    "not %s" % (value, type(value)))\n', "InvalidHeader: Header value 0.543614 must be of type str or bytes, not <type 'float'>\n"]
['Traceback (most recent call last):\n', '  File "/bin/insights-client", line 11, in <module>\n    load_entry_point(\'insights-client==2.0.5\', \'console_scripts\', \'insights-client\')()\n', '  File "/usr/lib/python2.7/site-packages/insights_client/__init__.py", line 723, in _main\n    rc = collect_data_and_upload()\n', '  File "/usr/lib/python2.7/site-packages/insights_client/__init__.py", line 618, in collect_data_and_upload\n    rc = _do_upload(pconn, full_tar_file, logging_name, collection_duration)\n', '  File "/usr/lib/python2.7/site-packages/insights_client/__init__.py", line 636, in _do_upload\n    docker_group=InsightsClient.options.container_mode))\n', '  File "/usr/lib/python2.7/site-packages/insights_client/connection.py", line 755, in upload_archive\n    upload = self.session.post(upload_url, files=files, headers=headers)\n', '  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 535, in post\n    return self.request(\'POST\', url, data=data, json=json, **kwargs)\n', '  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 474, in request\n    prep = self.prepare_request(req)\n', '  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 407, in prepare_request\n    hooks=merge_hooks(request.hooks, self.hooks),\n', '  File "/usr/lib/python2.7/site-packages/requests/models.py", line 303, in prepare\n    self.prepare_headers(headers)\n', '  File "/usr/lib/python2.7/site-packages/requests/models.py", line 443, in prepare_headers\n    check_header_validity(header)\n', '  File "/usr/lib/python2.7/site-packages/requests/utils.py", line 796, in check_header_validity\n    "not %s" % (value, type(value)))\n', "InvalidHeader: Header value 0.543614 must be of type str or bytes, not <type 'float'>\n"]
Deleting: /var/tmp/W5cQkO
Deleting /var/tmp/_YGwUY

Fedora 26 Python 2.7.13 python2-requests 2.13.0

Tested with insights-client master (6e1d1b5ab75c632d75963dd9df709600ce5d0571) as well as 1.0.13-4

imported from Trello

gangelop commented 6 years ago

Hi, I'm trying to get familiar with the whole Insights project. I wanted to look into this issue as it appears simple to investigate (at least initially). But I'm not able to even get to the point of reproducing it because it's not clear how to setup a development environment for insights-client.

On Fedora 26 I've tired the following approach: (I also created an "insights" user because otherwise it was complaining about permissions in /var/log)

git clone https://github.com/RedHatInsights/insights-core.git
git clone https://github.com/RedHatInsights/insights-client.git
cd insights-client
virtualenv .
source bin/activate
pip install -e .
pip install -e ../insights-core

And after all this I get... a mysterious failure:

(insights-client) [george@f26 insights-client]$ insights-client
(insights-client) [george@f26 insights-client]$ echo $?
1
(insights-client) [george@f26 insights-client]$ insights-client --verbose
2017-11-23 16:15:59,857    DEBUG insights.client.client Logging initialized
(insights-client) [george@f26 insights-client]$ insights-client --verbose --register
2017-11-23 16:16:02,776    DEBUG insights.client.client Logging initialized
(insights-client) [george@f26 insights-client]$ redhat-access-insights --verbose
2017-11-23 16:28:42,974    DEBUG insights.client.client Logging initialized

Full paste of the aforementioned procedure: https://hastebin.com/raw/ibeligawan

Questions

I'm hoping that if I can find the answers to these questions we can also document them in the README.md of the relevant project so that future contributors don't get stuck on this.

kylape commented 6 years ago

Hi @gangelop, sorry for the big confusion here. This issue was migrated from a Trello board, and it appears it is related to insights-client version 1.0.13, which is actually called redhat-access-insights. This is a different code repo, found at https://github.com/redhataccess/insights-client. Thus, we should probably close this issue out and track it elsewhere.

To answer your questions around getting the new insights-client to run at all, you probably need a basic understanding of how the code gets executed. We designed the client to fetch a Python egg from Red Hat with most of the client implementation packaged inside. Thus you need to build an egg to be used by the RPM. Also, it probably makes the most sense to build the RPM and install it in order to have insights-client run as it expects to. So, in a nutshell:

git clone https://github.com/RedHatInsights/insights-core.git
git clone https://github.com/RedHatInsights/insights-client.git
cd insights-core
virtualenv .
. bin/activate
pip install -e .[develop]
./build_client_egg.sh
cp insights.egg ../insights-client/etc/rpm.egg # install generated egg into expected location
cd ../insights-client
make clean all
sudo yum install dist/RPMS/noarch/insights-client-3.0.2-2.fc26.noarch.rpm
insights-client --no-gpg