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

Minor updater... updates #4020

Merged
merged 4 commits into from
Oct 24, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Enable updater in dev versions
  • Loading branch information
robbiet480 committed Oct 24, 2016
commit 183b679295c74ab478b3aa100b3f40af6f6e6bc4
15 changes: 8 additions & 7 deletions homeassistant/components/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ def setup(hass, config):
"""Setup the updater component."""
if 'dev' in CURRENT_VERSION:
# This component only makes sense in release versions
_LOGGER.warning('Updater not supported in development version')
return False
_LOGGER.warning(('Updater component enabled in dev. '
'You will not receive notifications of new '
'versions but analytics will be submitted.'))

config = config.get(DOMAIN, {})
huuid = _load_uuid(hass) if config.get(CONF_REPORTING) else None
Expand All @@ -80,8 +81,9 @@ def check_newest_version(hass, huuid):
"""Check if a new version is available and report if one is."""
newest, releasenotes = get_newest_version(huuid)

if newest is not None:
if newest is not None and 'dev' not in CURRENT_VERSION:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we turn it around for code clarity.

if newst is None or 'dev' in CURRENT_VERSION:
    return

if Strict

if StrictVersion(newest) > StrictVersion(CURRENT_VERSION):
_LOGGER.info('The latest available version is %s.', newest)
hass.states.set(
ENTITY_ID, newest, {ATTR_FRIENDLY_NAME: 'Update Available',
ATTR_RELEASE_NOTES: releasenotes}
Expand All @@ -95,7 +97,7 @@ def get_newest_version(huuid):
'os_name': platform.system(), "arch": platform.machine(),
'python_version': platform.python_version(),
'virtualenv': (os.environ.get('VIRTUAL_ENV') is not None),
'docker': False}
'docker': False, 'dev': ('dev' in CURRENT_VERSION)}

if platform.system() == 'Windows':
info_object['os_version'] = platform.win32_ver()[0]
Expand All @@ -114,9 +116,8 @@ def get_newest_version(huuid):
try:
req = requests.post(UPDATER_URL, json=info_object)
res = req.json()
_LOGGER.info(('The latest version is %s. '
'Information submitted includes %s'),
res['version'], info_object)
_LOGGER.info(('Submitted analytics to Home Assistant servers. '
'Information submitted includes %s'), info_object)
return (res['version'], res['release-notes'])
except requests.RequestException:
_LOGGER.exception('Could not contact HASS Update to check for updates')
Expand Down