Comment 1 for bug 1922412

Revision history for this message
Utkarsh Gupta (utkarsh) wrote :

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?