Hello Bryce,

Thanks for taking the time to file a bug and making Ubuntu server
better! ^.^

In my opinion, I'd expect those two directories to be there, if they're
not, then there's something wrong, really. Either a user manipulation or
whatever. Maybe instead of the hook failing, it could gracefully exit,
mentioning that both the directories aren't present which is somewhat
unusual.

The code comes from debian/additions/source_mysql-8.0.py:
55     for d in ['/etc/mysql/conf.d', '/etc/mysql/mysql.conf.d']:
56         for f in os.listdir(d):
57             _add_my_conf_files(report, os.path.join(d, f))

...maybe this could be be changed to something like:
```
--- a/debian/additions/source_mysql-8.0.py
+++ b/debian/additions/source_mysql-8.0.py
@@ -54,7 +54,10 @@ def add_info(report):
     _add_my_conf_files(report, '/etc/mysql/mysql.cnf')
     for d in ['/etc/mysql/conf.d', '/etc/mysql/mysql.conf.d']:
         for f in os.listdir(d):
-            _add_my_conf_files(report, os.path.join(d, f))
+            try:
+                _add_my_conf_files(report, os.path.join(d, f))
+            except FileNotFoundError:
+                print("Either of /etc/mysql/conf.d or /etc/mysql/mysql.conf.d 
should be present, exiting..")
     try:
         report['MySQLVarLibDirListing'] = str(os.listdir('/var/lib/mysql'))
     except OSError:

```

what do you think?

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1922412

Title:
  apport hook fails if '/etc/mysql/conf.d' or '/etc/mysql/mysql.conf.d'
  don't exist

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mysql-8.0/+bug/1922412/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to