Skip to content

Handle case where user hasn't copied the config file #10

@steveatinfincia

Description

@steveatinfincia

This should be automated or improved somehow, checking to see if /etc/netrng.conf exists seems like the wrong thing to do but it would at least show an informative error about what to do.

There are config defaults included in the code, but they're really intended for cases where a user upgrades an older version of NetRNG to a new version that makes use of a newly introduced config option that isn't present in their own local config file yet.

Pythons configparser module is somewhat unfriendly in this situation as we have 3 custom sections, Global, Server, and Client to keep options properly segmented.

Example of what happens when the config file hasn't been copied at all to /etc/netrng.conf:

Traceback (most recent call last):
  File "/opt/NetRNG/bin/netrngd", line 7, in <module>
    from netrng.daemon import main
  File "/opt/NetRNG/local/lib/python2.7/site-packages/netrng/daemon.py", line 56, in <module>
    DEBUG = netrng_config.getboolean('Global', 'debug')
  File "/usr/lib/python2.7/ConfigParser.py", line 368, in getboolean
    v = self.get(section, option)
  File "/usr/lib/python2.7/ConfigParser.py", line 607, in get
    raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'Global'

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions