furlongm / patchman

Patchman is a Linux Patch Status Monitoring System
http://patchman.openbytes.ie
GNU General Public License v3.0
359 stars 78 forks source link

Patchman-client throwing error #544

Closed jaydeepch15 closed 4 months ago

jaydeepch15 commented 11 months ago

After sorting this out https://github.com/furlongm/patchman/issues/538 Now when Tried to push data from client server i.e

[root@server01 ~]# /usr/sbin/patchman-client -r
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>500 - Server Error</title>
</head>
<body>
<h1>500 - Server Error</h1>
<p>There has been an error. It has been reported to the site administrators and should be fixed shortly.<p>
</body>
</html>

I also tried upgrade patchman-client but same error.

On patchman server when hit patchman -a

get below

Processing Reports for all Hosts
Error: OS, kernel or arch not sent with report 14123
Error: OS, kernel or arch not sent with report 14124
Error: OS, kernel or arch not sent with report 14125
Error: OS, kernel or arch not sent with report 14128
Error: OS, kernel or arch not sent with report 14126
Error: OS, kernel or arch not sent with report 14127

then it proceed further even shows old and new packages per client server, But still not on Dashboard

furlongm commented 11 months ago

Can you enable DEBUG on the server and post the stacktrace from the apache log?

Pavel077 commented 10 months ago

Hello.

I had 500 error too, this solution helped me.

jaydeepch15 commented 10 months ago

@furlongm @Pavel077 I tried above mentioned workaround but it did not fix my issue. Below is apache configuration for patchman

root@awslpatchman:~# cat /etc/apache2/conf-enabled/patchman.conf
Define patchman_pythonpath /usr/lib/python3/dist-packages
WSGIScriptAlias /patchman ${patchman_pythonpath}/patchman/wsgi.py
WSGIPythonPath ${patchman_pythonpath}
WSGIApplicationGroup %{GLOBAL}

<Directory ${patchman_pythonpath}>
    <Files wsgi.py>
        Require all granted
    </Files>
    AllowOverride All
</Directory>

Alias /patchman/static "/var/lib/patchman/static"
<Location /patchman/static>
    SetHandler None
</Location>

<Directory /var/lib/patchman/static>
    Require all granted
</Directory>

<Location /patchman/reports/upload>
    # Add the IP addresses of your client networks/hosts here
    # to allow uploading of reports
    #Require ip 127.0.0.0/255.0.0.0
    Require all granted
    #Require ip ::1/128
</Location>

I below are the apache error logs

[Tue Jan 02 04:41:44.965684 2024] [wsgi:error] [pid 626:tid 140449146709568] [client 172.51.113.250:42646] Internal Server Error: /patchman/reports/upload/
[Tue Jan 02 04:41:44.965824 2024] [wsgi:error] [pid 626:tid 140449146709568] [client 172.51.113.250:42646] Traceback (most recent call last):
[Tue Jan 02 04:41:44.965856 2024] [wsgi:error] [pid 626:tid 140449146709568] [client 172.51.113.250:42646]   File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", line 47, in inner
[Tue Jan 02 04:41:44.965892 2024] [wsgi:error] [pid 626:tid 140449146709568] [client 172.51.113.250:42646]     response = get_response(request)
[Tue Jan 02 04:41:44.965918 2024] [wsgi:error] [pid 626:tid 140449146709568] [client 172.51.113.250:42646]   File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 181, in _get_response
[Tue Jan 02 04:41:44.965947 2024] [wsgi:error] [pid 626:tid 140449146709568] [client 172.51.113.250:42646]     response = wrapped_callback(request, *callback_args, **callback_kwargs)
[Tue Jan 02 04:41:44.965976 2024] [wsgi:error] [pid 626:tid 140449146709568] [client 172.51.113.250:42646]   File "/usr/lib/python3/dist-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
[Tue Jan 02 04:41:44.966041 2024] [wsgi:error] [pid 626:tid 140449146709568] [client 172.51.113.250:42646]     return view_func(*args, **kwargs)
[Tue Jan 02 04:41:44.966059 2024] [wsgi:error] [pid 626:tid 140449146709568] [client 172.51.113.250:42646]   File "/usr/lib/python3/dist-packages/reports/views.py", line 43, in upload
[Tue Jan 02 04:41:44.966066 2024] [wsgi:error] [pid 626:tid 140449146709568] [client 172.51.113.250:42646]     report.parse(data, meta)
[Tue Jan 02 04:41:44.966071 2024] [wsgi:error] [pid 626:tid 140449146709568] [client 172.51.113.250:42646]   File "/usr/lib/python3/dist-packages/reports/models.py", line 89, in parse
[Tue Jan 02 04:41:44.966078 2024] [wsgi:error] [pid 626:tid 140449146709568] [client 172.51.113.250:42646]     setattr(self, attr, data.get(attr).strip())
[Tue Jan 02 04:41:44.966084 2024] [wsgi:error] [pid 626:tid 140449146709568] [client 172.51.113.250:42646] AttributeError: 'NoneType' object has no attribute 'strip'
furlongm commented 10 months ago

Are you running the latest version of patchman-client on the client?

jaydeepch15 commented 10 months ago

@furlongm Yes, It is latest. patchman-client | | 3.0.4 | 1 | all | deb |

furlongm commented 10 months ago

And the server is latest too?

furlongm commented 10 months ago

Can you try with 3.0.7 on both server and client?

mastro-pi commented 10 months ago

this version solves the problem (which I also had). Thx.. and keep up your good work

jaydeepch15 commented 10 months ago

on patchman server I tried apt upgrade patchman* below is snippet of output


WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
        HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. I
t is strongly recommended you activate it. See: https://docs.djangoproject.com/en/3.2/ref/databases/#mysql-sql-mode
Operations to perform:
  Synchronize unmigrated apps: admindocs, bootstrap3, celery, django_extensions, django_filters, humanize, messages, rest_framework, staticfiles, util
  Apply all migrations: admin, arch, auth, contenttypes, domains, hosts, modules, operatingsystems, packages, reports, repos, sessions, sites, tagging
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
Running migrations:
  Applying arch.0001_initial... FAKED
  Applying domains.0001_initial... FAKED
  Applying operatingsystems.0001_initial... FAKED
  Applying packages.0001_initial... FAKED
  Applying repos.0001_initial... FAKED
  Applying modules.0001_initial... FAKED
  Applying operatingsystems.0002_initial... FAKED
  Applying hosts.0001_initial... FAKED
  Applying hosts.0002_initial... FAKED
  Applying hosts.0003_host_modules...Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 82, in _execute
    return self.cursor.execute(sql)
  File "/usr/lib/python3/dist-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
  File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 315, in _query
    db.query(q)
  File "/usr/lib/python3/dist-packages/MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1050, "Table 'hosts_host_modules' already exists")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/patchman-manage", line 39, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 89, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/django/core/management/commands/migrate.py", line 244, in handle
    post_migrate_state = executor.migrate(
  File "/usr/lib/python3/dist-packages/django/db/migrations/executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/usr/lib/python3/dist-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/usr/lib/python3/dist-packages/django/db/migrations/executor.py", line 227, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/lib/python3/dist-packages/django/db/migrations/migration.py", line 126, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/usr/lib/python3/dist-packages/django/db/migrations/operations/fields.py", line 104, in database_forwards
    schema_editor.add_field(
  File "/usr/lib/python3/dist-packages/django/db/backends/mysql/schema.py", line 98, in add_field
    super().add_field(model, field)
  File "/usr/lib/python3/dist-packages/django/db/backends/base/schema.py", line 488, in add_field
    return self.create_model(field.remote_field.through)
  File "/usr/lib/python3/dist-packages/django/db/backends/base/schema.py", line 345, in create_model
    self.execute(sql, params or None)
  File "/usr/lib/python3/dist-packages/django/db/backends/base/schema.py", line 145, in execute
    cursor.execute(sql, params)
  File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 98, in execute
    return super().execute(sql, params)
  File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 79, in _execute
    with self.db.wrap_database_errors:
  File "/usr/lib/python3/dist-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 82, in _execute
    return self.cursor.execute(sql)
  File "/usr/lib/python3/dist-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
  File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 315, in _query
    db.query(q)
  File "/usr/lib/python3/dist-packages/MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)
django.db.utils.OperationalError: (1050, "Table 'hosts_host_modules' already exists")
dpkg: error processing package python3-patchman (--configure):
 installed python3-patchman package post-installation script subprocess returned error exit status 1
Setting up patchman-client (3.0.7-1) .

root@awslpatchman:~#   dpkg -l patchman
dpkg-query: no packages found matching patchman

root@awslpatchman:~#   dpkg -l patchman-client
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name            Version      Architecture Description
+++-===============-============-============-==========================================
ii  patchman-client 3.0.7-1      all          Client for the patchman monitoring system.

Is there any way to check patchman server version?

furlongm commented 10 months ago

You may need to remove the table added here:

https://github.com/furlongm/patchman/issues/538#issuecomment-1845622931

jaydeepch15 commented 10 months ago

I dropped table using DROP TABLE hosts_host_modules;

Also Had to run ALTER TABLE reports_report DROP COLUMN modules;

still seeing

Processing Reports for all Hosts
Error: OS, kernel or arch not sent with report 15032
Error: OS, kernel or arch not sent with report 15031
Error: OS, kernel or arch not sent with report 15033
Error: OS, kernel or arch not sent with report 15035
Error: OS, kernel or arch not sent with report 15036
Error: OS, kernel or arch not sent with report 15037
Error: OS, kernel or arch not sent with report 15038
Error: OS, kernel or arch not sent with report 15039
Error: OS, kernel or arch not sent with report 15040
Error: OS, kernel or arch not sent with report 15041
Error: OS, kernel or arch not sent with report 15042
Error: OS, kernel or arch not sent with report 15043
Error: OS, kernel or arch not sent with report 15044
Error: OS, kernel or arch not sent with report 15045
Error: OS, kernel or arch not sent with report 15046
Error: OS, kernel or arch not sent with report 15051
Error: OS, kernel or arch not sent with report 15047
Error: OS, kernel or arch not sent with report 15049
Error: OS, kernel or arch not sent with report 15048
Error: OS, kernel or arch not sent with report 15050
Error: OS, kernel or arch not sent with report 15052
Error: OS, kernel or arch not sent with report 15053
Error: OS, kernel or arch not sent with report 15054
Error: OS, kernel or arch not sent with report 15055
Error: OS, kernel or arch not sent with report 15056
Error: OS, kernel or arch not sent with report 15057
Error: OS, kernel or arch not sent with report 15058
Error: OS, kernel or arch not sent with report 15059
Error: OS, kernel or arch not sent with report 15060
Error: OS, kernel or arch not sent with report 15061
Error: OS, kernel or arch not sent with report 15062
Error: OS, kernel or arch not sent with report 15063
Error: OS, kernel or arch not sent with report 15064
Error: OS, kernel or arch not sent with report 15065
Error: OS, kernel or arch not sent with report 15066
Error: OS, kernel or arch not sent with report 15067
Error: OS, kernel or arch not sent with report 15068
Error: OS, kernel or arch not sent with report 15069
Error: OS, kernel or arch not sent with report 15070
Error: OS, kernel or arch not sent with report 15071
Error: OS, kernel or arch not sent with report 15072
Error: OS, kernel or arch not sent with report 15073
Error: OS, kernel or arch not sent with report 15074
Error: OS, kernel or arch not sent with report 15075
Error: OS, kernel or arch not sent with report 15076
Error: OS, kernel or arch not sent with report 15080
Error: OS, kernel or arch not sent with report 15077
Error: OS, kernel or arch not sent with report 15078
Error: OS, kernel or arch not sent with report 15079
Error: OS, kernel or arch not sent with report 15081
Error: OS, kernel or arch not sent with report 15082
Error: OS, kernel or arch not sent with report 15083
Error: OS, kernel or arch not sent with report 15084
Error: OS, kernel or arch not sent with report 15085
Error: OS, kernel or arch not sent with report 15086
Error: OS, kernel or arch not sent with report 15087
Error: OS, kernel or arch not sent with report 15088
Error: OS, kernel or arch not sent with report 15089
Error: OS, kernel or arch not sent with report 15090
Error: OS, kernel or arch not sent with report 15091
Error: OS, kernel or arch not sent with report 15092
Error: OS, kernel or arch not sent with report 15093
Error: OS, kernel or arch not sent with report 15094
Error: OS, kernel or arch not sent with report 15095
Error: OS, kernel or arch not sent with report 15096
Error: OS, kernel or arch not sent with report 15097
Reverse DNS check disabled

Most of my client server has Amazon Linux 2 - patchman-client-2.0.18-1 version

PS - On patchman server python3-patchman and patchman-client both are 3.0.7

furlongm commented 10 months ago

Could you clean the existing reports and try with newer client on Amazon Linux 2?

jaydeepch15 commented 10 months ago

I followed below steps

  1. Removed patchman-client from Amazon-2 Instance (Assuming it will delete all associated reports with it)

  2. Re-install it again. (this version we get from yum repository patchman-client.noarch 0:2.0.18-1)

    [root@client01 ~]# cat /etc/yum.repos.d/openbytes.repo
    [openbytes]
    name=openbytes
    baseurl=https://repo.openbytes.ie/patchman/el8
    enabled=1
    gpgcheck=0
  3. Ran patchman-client -r and Below is output

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>500 - Server Error</title>
    </head>
    <body>
    <h1>500 - Server Error</h1>
    <p>There has been an error. It has been reported to the site administrators and should be fixed shortly.<p>
    </body>
    </html>
  4. Then Edited openbytes.repo

    [root@client01 ~]# cat /etc/yum.repos.d/openbytes.repo
    [openbytes]
    name=openbytes
    baseurl=https://repo.openbytes.ie/patchman/el9
    enabled=1
    gpgcheck=0
  5. Got below error while installing

    
    [root@client01 ~]$ sudo yum install patchman-client
    Loaded plugins: priorities, update-motd, upgrade-helper
    Repository packages-microsoft-com-prod is listed more than once in the configuration
    245 packages excluded due to repository priority protections
    Resolving Dependencies
    --> Running transaction check
    ---> Package patchman-client.noarch 0:3.0.7-1 will be installed
    --> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================ Package Arch Version Repository Size

Installing: patchman-client noarch 3.0.7-1 openbytes 13 k

Transaction Summary

Install 1 Package

Total size: 13 k Installed size: 22 k Is this ok [y/d/N]: y Downloading packages: Running transaction check ERROR You need to update rpm to handle: rpmlib(PayloadIsZstd) <= 5.4.18-1 is needed by patchman-client-3.0.7-1.noarch RPM needs to be updated You could try running: rpm -Va --nofiles --nodigest Your transaction was saved, rerun it with: yum load-transaction /tmp/yum_save_tx.2024-01-17.03-28.DOByt7.yumtx

cracksmokinmonkeys commented 8 months ago

I'm seeing the same issues on reports/upload.

No matter how I install: Docker, rpm, or python virtual environment.

I am able to get past hurdles for the type of installation to the point when I can run the application using gunicorn, apache, or nginx and trying to upload give the results you see above.

My gunicorn output shows:

Internal Server Error: /reports/upload/ Traceback (most recent call last): File "/opt/patchman/lib64/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/opt/patchman/lib64/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, *callback_kwargs) File "/opt/patchman/lib64/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view return view_func(args, **kwargs) File "/opt/patchman/lib64/python3.9/site-packages/reports/views.py", line 43, in upload report.parse(data, meta) File "/opt/patchman/lib64/python3.9/site-packages/reports/models.py", line 89, in parse setattr(self, attr, data.get(attr).strip()) AttributeError: 'NoneType' object has no attribute 'strip'

I am running AlmaLinux 9.3, with python3.9, using python -m venv

to setup the virtual environment.

furlongm commented 8 months ago

Can you try the following patch?

diff --git a/reports/models.py b/reports/models.py
index 7fdc7fb..75cad75 100644
--- a/reports/models.py
+++ b/reports/models.py
@@ -86,7 +86,8 @@ class Report(models.Model):
                  'reboot']

         for attr in attrs:
-            setattr(self, attr, data.get(attr).strip())
+            if data.get(attr):
+                setattr(self, attr, data.get(attr))

         if self.host is not None:
cracksmokinmonkeys commented 8 months ago

Its working !!!!

Its at least gotten me past the patchman-client issue with either 404 or 500 errors.

Thanks Marcus!

jaydeepch15 commented 8 months ago

@furlongm I am still getting below error

[root@client01 ~]$ sudo yum install patchman-client
Loaded plugins: priorities, update-motd, upgrade-helper
Repository packages-microsoft-com-prod is listed more than once in the configuration
245 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package patchman-client.noarch 0:3.0.7-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================
 Package                                    Arch                              Version                            Repository                            Size
============================================================================================================================================================
Installing:
 patchman-client                            noarch                            3.0.7-1                            openbytes                             13 k

Transaction Summary
============================================================================================================================================================
Install  1 Package

Total size: 13 k
Installed size: 22 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
ERROR You need to update rpm to handle:
rpmlib(PayloadIsZstd) <= 5.4.18-1 is needed by patchman-client-3.0.7-1.noarch
RPM needs to be updated
 You could try running: rpm -Va --nofiles --nodigest
Your transaction was saved, rerun it with:
 yum load-transaction /tmp/yum_save_tx.2024-01-17.03-28.DOByt7.yumtx

can you please let me know how to apply above patch, I am not much familiar with python. this is how updated /srv/patchman/reports/models.py (snippet)

 class Report(models.Model):

    created = models.DateTimeField(auto_now_add=True)
    accessed = models.DateTimeField(auto_now_add=True)
    host = models.CharField(max_length=255, null=True)
    domain = models.CharField(max_length=255, null=True)
    tags = models.CharField(max_length=255, null=True, default='')
    kernel = models.CharField(max_length=255, null=True)
    arch = models.CharField(max_length=255, null=True)
    os = models.CharField(max_length=255, null=True)
    report_ip = models.GenericIPAddressField(null=True)
    protocol = models.CharField(max_length=255, null=True)
    useragent = models.CharField(max_length=255, null=True)
    processed = models.BooleanField(default=False)
    packages = models.TextField(null=True, blank=True)
    sec_updates = models.TextField(null=True, blank=True)
    bug_updates = models.TextField(null=True, blank=True)
    repos = models.TextField(null=True, blank=True)
    reboot = models.TextField(null=True, blank=True)

    class Meta(object):
        verbose_name_plural = 'Report'
        verbose_name_plural = 'Reports'
        ordering = ('-created',)

    def __str__(self):
        return '{0!s} {1!s}'.format(self.host, self.created.strftime('%c'))

    def get_absolute_url(self):
        return reverse('reports:report_detail', args=[str(self.id)])

    def parse(self, data, meta):

        x_real_ip = meta.get('HTTP_X_REAL_IP')
        x_forwarded_for = meta.get('HTTP_X_FORWARDED_FOR')
        if x_forwarded_for:
            self.report_ip = x_forwarded_for.split(',')[0]
        elif x_real_ip:
            self.report_ip = x_real_ip
        else:
            self.report_ip = meta['REMOTE_ADDR']
        self.useragent = meta['HTTP_USER_AGENT']
        self.domain = None

        attrs = ['arch', 'host', 'os', 'kernel', 'protocol', 'packages',
                 'tags', 'sec_updates', 'bug_updates', 'repos', 'reboot']

        for attr in attrs:
            #setattr(self, attr, data.get(attr).strip())
            if data.get(attr):
                setattr(self, attr, data.get(attr))

        if self.host is not None:
            self.host = self.host.lower()
            fqdn = self.host.split('.', 1)
            if len(fqdn) == 2:
                self.domain = fqdn.pop()

And rebooted patchman server, still client from amazon Linux 2 showing

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>500 - Server Error</title>
</head>
<body>
<h1>500 - Server Error</h1>
<p>There has been an error. It has been reported to the site administrators and should be fixed shortly.<p>
</body>
</html>

Below is error

Internal Server Error: /patchman/reports/upload/

AttributeError at /reports/upload/
'NoneType' object has no attribute 'strip'

Request Method: POST
Request URL: http://patchman.mysite.net/patchman/reports/upload/
Django Version: 3.2.12
Python Executable: /usr/bin/python3
Python Version: 3.10.12
Python Path: ['/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/usr/local/lib/python3.10/dist-packages', '/usr/lib/python3/dist-packages']
Server time: Fri, 08 Mar 2024 00:00:11 -0500
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'django.contrib.admindocs',
 'django.contrib.sites',
 'django_extensions',
 'tagging',
 'bootstrap3',
 'rest_framework',
 'django_filters',
 'celery',
 'arch.apps.ArchConfig',
 'domains.apps.DomainsConfig',
 'hosts.apps.HostsConfig',
 'modules.apps.ModulesConfig',
 'operatingsystems.apps.OperatingsystemsConfig',
 'packages.apps.PackagesConfig',
 'repos.apps.ReposConfig',
 'reports.apps.ReportsConfig',
 'util.apps.UtilConfig']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.middleware.cache.UpdateCacheMiddleware',
 'django.middleware.http.ConditionalGetMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.cache.FetchFromCacheMiddleware']

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3/dist-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/reports/views.py", line 43, in upload
    report.parse(data, meta)
  File "/usr/lib/python3/dist-packages/reports/models.py", line 89, in parse
    setattr(self, attr, data.get(attr).strip())

Exception Type: AttributeError at /reports/upload/
Exception Value: 'NoneType' object has no attribute 'strip'
Shakall1944 commented 8 months ago

Hello,

I have the same issue on the lastest patchman server and client:

Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.http.ConditionalGetMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.cache.FetchFromCacheMiddleware']

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, *callback_kwargs) File "/usr/lib/python3/dist-packages/django/views/decorators/csrf.py", line 54, in wrapped_view return view_func(args, **kwargs) File "/usr/lib/python3/dist-packages/reports/views.py", line 43, in upload report.parse(data, meta) File "/usr/lib/python3/dist-packages/reports/models.py", line 89, in parse if data.get(attr):

Exception Type: AttributeError at /reports/upload/ Exception Value: 'NoneType' object has no attribute 'strip'

I've even tried patch mentioned above but as you can see it's this the same error.

Do you have news regarding this topic?

Thank you

furlongm commented 4 months ago

@jaydeepch15 it looks like you applied the patch but it's still failing on strip which should no longer be running.

Does restarting the web server help to reload the file?

furlongm commented 4 months ago

Can you try commit 0404e57c8fc61ce33a88c3ccd7b672a08cdf1083 in PR #594 ? Hoping this will fix this issue too