Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application Configuration File Logic With Package Installation Methods #239

Open
kb1lqc opened this issue Jul 7, 2017 · 1 comment
Open
Labels

Comments

@kb1lqc
Copy link
Member

kb1lqc commented Jul 7, 2017

Summary

Weird name I know... Basically I noticed that after pip install faraday that if I was in the github main repo folder performing Faraday configuration commands such as faraday-proxy --init-config and faraday-proxy --callsign... the local /etc/faraday files are edited instead of the main installation files. While not a bug that stops operation it could be annoying when you don't realize that running faraday from a different folder location might result in using different configuration files!

@kb1lqd @reillyeon @el-iso

Problem Explanation

I would expect with a pip install in non-editable mode to see (Windows) C:\Python27\etc\faraday file change. The local etc/faraday files are really only for editable pip installs. The following steps need to be taken

  • Determine nominal operation of pip install faraday configuration files for all applications
  • Check applications to see if we are violating these intended operations
  • Fix operation if required

Environment

Software

Master Branch

Hardware

Faraday Rev D1

Supporting Information

N/A

@kb1lqc kb1lqc added the bug label Jul 7, 2017
@kb1lqc kb1lqc added this to the Alpha Software milestone Jul 7, 2017
@kb1lqc
Copy link
Member Author

kb1lqc commented Oct 7, 2017

As a note I learned about os.path.expanduser("~") with aprs2influxdb work... probably useful here.

def getConfig():
        """Open configuration file and return a list of config database

        Searches the current directory as well as Python specific install
        location such as /etc/<installPath> or C:/python27/<installPath>.
        Returns a list of config file desciptor as well as the path it was found
        at so other operations can use it to open the file.
        """
        # Known paths where loggingConfig.ini can exist
        installPath = os.path.join(sys.prefix, "etc", "aprs2influxdb", "config.ini")
        installPath2 = os.path.join(os.path.expanduser("~"), ".local", "etc", "aprs2influxdb", "config.ini")
        localPath = os.path.join(os.curdir, "config.ini")

        # Check all directories until first instance of loggingConfig.ini
        for location in localPath, installPath, installPath2:
            try:
                config = ConfigParser.RawConfigParser()
                result = config.read(location)
            except ConfigParser.NoSectionError:
                pass

            if result:
                break

        return [config, location]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant