Skip to content

Make setup more robust#23414

Merged
pvizeli merged 2 commits intodevfrom
make-setup-more-robust
Apr 26, 2019
Merged

Make setup more robust#23414
pvizeli merged 2 commits intodevfrom
make-setup-more-robust

Conversation

@balloob
Copy link
Copy Markdown
Member

@balloob balloob commented Apr 25, 2019

Description:

While trying to research reported custom component failure (I couldn't repro), I did some other tweaks to make us more resistant to bad custom components:

  • Don't crash if component doesn't define a setup method
  • Don't crash if component doesn't define DOMAIN

@balloob balloob added this to the 0.92.1 milestone Apr 25, 2019
@balloob balloob requested a review from a team as a code owner April 25, 2019 23:28
@homeassistant homeassistant added cla-signed core small-pr PRs with less than 30 lines. labels Apr 25, 2019
Comment thread homeassistant/setup.py
await entry.async_setup(hass, integration=integration)

hass.config.components.add(component.DOMAIN) # type: ignore
hass.config.components.add(domain)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we use component.DOMAIN in other places, or does this mean we don't need to define DOMAIN anymore?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes because of manifest

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, it's optional now. I think that it's still good to keep around and use it to as a key for hass.data etc, because it allows for people to easily copy an integration and change the DOMAIN value to make a copy.

@pvizeli pvizeli merged commit d6f6273 into dev Apr 26, 2019
@delete-merged-branch delete-merged-branch Bot deleted the make-setup-more-robust branch April 26, 2019 19:41
pvizeli pushed a commit that referenced this pull request Apr 26, 2019
* Make setup more robust

* Fix typing
@pvizeli pvizeli mentioned this pull request Apr 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants