detect_os() and unsupported OS

Issue #18 resolved
Vladimir Mihailenco
created an issue

Some commands are broken by detect_os() running on unsupported OS. For example:



os = utils.detect_os()
if os not in backports:
    fabric_utils.puts("Backports are not available for " + os)


In such case detect_os() returns None (as it can not detect OS) and exception is raised:



TypeError: cannot concatenate 'str' and 'NoneType' objects }}}

This can be fixed returning 'unknown' instead of None, or using string formatting:



fabric_utils.puts("Backports are not available for %s" % os) }}}

Comments (3)

  1. Mikhail Korobov repo owner

    I think detect_os should even raise an exception if OS can't be detected because django-fab-deploy relies on OS detection and so it can to bad things if OS detection errors are surpassed.

    If developer is testing new OS he/she can set env.conf.OS variable to any value. This value will be returned by detect_os as-is. A patch with proper OS detection code can be submitted later in this case.

  2. Log in to comment