Advice wanted for failing ansible-test sanity checks for contributed modules

Hello All,

I have submitted a PR for two new modules for mongodb. These were based on the existing mongodb modules and thus I re-used some of code. The PR is failing on two ansible-test sanity checks…

lib/ansible/modules/database/mongodb/mongodb_replicaset.py:271:24: use argspec type=“path” instead of type=“str” to avoid use of expanduser
lib/ansible/modules/database/mongodb/mongodb_shard.py:215:24: use argspec type=“path” instead of type=“str” to avoid use of expanduser

This is from the following function…

`

def load_mongocnf():

config = configparser.RawConfigParser()

mongocnf = os.path.expanduser(‘~/.mongodb.cnf’)

try:

config.readfp(open(mongocnf))

creds = dict(

user=config.get(‘client’, ‘user’),

password=config.get(‘client’, ‘pass’)

)

except (configparser.NoOptionError, IOError):

return False

return creds

`

I don’t really think the suggestion here is appropriate as it’s not a user supplied value. This code is present as-is in the existing mongodb modules so I’m not sure I should take a different approach either. What would be the preferred course of action here?

The pull request is: https://github.com/ansible/ansible/pull/41881

Rhys