mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-08 17:56:33 +00:00
Spelling and grammar fixes (#499)
This commit is contained in:
parent
41943ba61a
commit
e2725f8033
2
API.md
2
API.md
@ -579,7 +579,7 @@ return:
|
||||
|
||||
#### MQTT
|
||||
|
||||
This service perform a auto discovery to Home-Assistant.
|
||||
This service performs an auto discovery to Home-Assistant.
|
||||
|
||||
- GET `/services/mqtt`
|
||||
```json
|
||||
|
@ -40,11 +40,11 @@ class AddonManager(CoreSysAttributes):
|
||||
return list(self.repositories_obj.values())
|
||||
|
||||
def get(self, addon_slug):
|
||||
"""Return a add-on from slug."""
|
||||
"""Return an add-on from slug."""
|
||||
return self.addons_obj.get(addon_slug)
|
||||
|
||||
def from_uuid(self, uuid):
|
||||
"""Return a add-on from uuid."""
|
||||
"""Return an add-on from uuid."""
|
||||
for addon in self.list_addons:
|
||||
if addon.is_installed and uuid == addon.uuid:
|
||||
return addon
|
||||
|
@ -70,7 +70,7 @@ class Addon(CoreSysAttributes):
|
||||
|
||||
@property
|
||||
def is_installed(self):
|
||||
"""Return True if a addon is installed."""
|
||||
"""Return True if an addon is installed."""
|
||||
return self._id in self._data.system
|
||||
|
||||
@property
|
||||
@ -164,7 +164,7 @@ class Addon(CoreSysAttributes):
|
||||
|
||||
@property
|
||||
def uuid(self):
|
||||
"""Return a API token for this add-on."""
|
||||
"""Return an API token for this add-on."""
|
||||
if self.is_installed:
|
||||
return self._data.user[self._id][ATTR_UUID]
|
||||
return None
|
||||
@ -411,7 +411,7 @@ class Addon(CoreSysAttributes):
|
||||
|
||||
@property
|
||||
def with_icon(self):
|
||||
"""Return True if a icon exists."""
|
||||
"""Return True if an icon exists."""
|
||||
return self.path_icon.exists()
|
||||
|
||||
@property
|
||||
@ -589,7 +589,7 @@ class Addon(CoreSysAttributes):
|
||||
return True
|
||||
|
||||
async def install(self):
|
||||
"""Install a addon."""
|
||||
"""Install an addon."""
|
||||
if self.sys_arch not in self.supported_arch:
|
||||
_LOGGER.error(
|
||||
"Addon %s not supported on %s", self._id, self.sys_arch)
|
||||
@ -612,7 +612,7 @@ class Addon(CoreSysAttributes):
|
||||
|
||||
@check_installed
|
||||
async def uninstall(self):
|
||||
"""Remove a addon."""
|
||||
"""Remove an addon."""
|
||||
if not await self.instance.remove():
|
||||
return False
|
||||
|
||||
@ -734,7 +734,7 @@ class Addon(CoreSysAttributes):
|
||||
|
||||
@check_installed
|
||||
async def snapshot(self, tar_file):
|
||||
"""Snapshot a state of a addon."""
|
||||
"""Snapshot state of an addon."""
|
||||
with TemporaryDirectory(dir=str(self.sys_config.path_tmp)) as temp:
|
||||
# store local image
|
||||
if self.need_build and not await \
|
||||
@ -773,7 +773,7 @@ class Addon(CoreSysAttributes):
|
||||
return True
|
||||
|
||||
async def restore(self, tar_file):
|
||||
"""Restore a state of a addon."""
|
||||
"""Restore state of an addon."""
|
||||
with TemporaryDirectory(dir=str(self.sys_config.path_tmp)) as temp:
|
||||
# extract snapshot
|
||||
def _extract_tarfile():
|
||||
|
@ -42,10 +42,10 @@ class APIAddons(CoreSysAttributes):
|
||||
"""Handle rest api for addons functions."""
|
||||
|
||||
def _extract_addon(self, request, check_installed=True):
|
||||
"""Return addon and if not exists trow a exception."""
|
||||
"""Return addon, throw an exception it it doesn't exist."""
|
||||
addon = self.sys_addons.get(request.match_info.get('addon'))
|
||||
if not addon:
|
||||
raise RuntimeError("Addon not exists")
|
||||
raise RuntimeError("Addon does not exist")
|
||||
|
||||
if check_installed and not addon.is_installed:
|
||||
raise RuntimeError("Addon is not installed")
|
||||
|
@ -10,10 +10,10 @@ class APIServices(CoreSysAttributes):
|
||||
"""Handle rest api for services functions."""
|
||||
|
||||
def _extract_service(self, request):
|
||||
"""Return service and if not exists trow a exception."""
|
||||
"""Return service, throw an exception if it doesn't exist."""
|
||||
service = self.sys_services.get(request.match_info.get('service'))
|
||||
if not service:
|
||||
raise RuntimeError("Service not exists")
|
||||
raise RuntimeError("Service does not exist")
|
||||
|
||||
return service
|
||||
|
||||
|
@ -49,10 +49,10 @@ class APISnapshots(CoreSysAttributes):
|
||||
"""Handle rest api for snapshot functions."""
|
||||
|
||||
def _extract_snapshot(self, request):
|
||||
"""Return addon and if not exists trow a exception."""
|
||||
"""Return snapshot, throw an exception if it doesn't exist."""
|
||||
snapshot = self.sys_snapshots.get(request.match_info.get('snapshot'))
|
||||
if not snapshot:
|
||||
raise RuntimeError("Snapshot not exists")
|
||||
raise RuntimeError("Snapshot does not exist")
|
||||
return snapshot
|
||||
|
||||
@api_process
|
||||
|
@ -119,7 +119,7 @@ class APISupervisor(CoreSysAttributes):
|
||||
|
||||
@api_process
|
||||
async def reload(self, request):
|
||||
"""Reload addons, config ect."""
|
||||
"""Reload addons, config etc."""
|
||||
tasks = [
|
||||
self.sys_updater.reload(),
|
||||
]
|
||||
|
@ -71,7 +71,7 @@ def api_process_raw(content):
|
||||
|
||||
|
||||
def api_return_error(message=None):
|
||||
"""Return a API error message."""
|
||||
"""Return an API error message."""
|
||||
return web.json_response({
|
||||
JSON_RESULT: RESULT_ERROR,
|
||||
JSON_MESSAGE: message,
|
||||
@ -79,7 +79,7 @@ def api_return_error(message=None):
|
||||
|
||||
|
||||
def api_return_ok(data=None):
|
||||
"""Return a API ok answer."""
|
||||
"""Return an API ok answer."""
|
||||
return web.json_response({
|
||||
JSON_RESULT: RESULT_OK,
|
||||
JSON_DATA: data or {},
|
||||
|
@ -147,7 +147,7 @@ class CoreSys:
|
||||
|
||||
@api.setter
|
||||
def api(self, value):
|
||||
"""Set a API object."""
|
||||
"""Set an API object."""
|
||||
if self._api:
|
||||
raise RuntimeError("API already set!")
|
||||
self._api = value
|
||||
|
@ -120,7 +120,7 @@ class DockerInterface(CoreSysAttributes):
|
||||
if container.status != 'running':
|
||||
return False
|
||||
|
||||
# we run on a old image, stop and start it
|
||||
# we run on an old image, stop and start it
|
||||
if container.image.id != image.id:
|
||||
return False
|
||||
|
||||
|
@ -116,7 +116,7 @@ class AlsaAudio(CoreSysAttributes):
|
||||
return self._default
|
||||
|
||||
def asound(self, alsa_input=None, alsa_output=None):
|
||||
"""Generate a asound data."""
|
||||
"""Generate an asound data."""
|
||||
alsa_input = alsa_input or self.default.input
|
||||
alsa_output = alsa_output or self.default.output
|
||||
|
||||
|
@ -24,7 +24,7 @@ RE_TTY = re.compile(r"tty[A-Z]+")
|
||||
|
||||
|
||||
class Hardware:
|
||||
"""Represent a interface to procfs, sysfs and udev."""
|
||||
"""Represent an interface to procfs, sysfs and udev."""
|
||||
|
||||
def __init__(self):
|
||||
"""Init hardware object."""
|
||||
|
@ -56,7 +56,7 @@ class Discovery(CoreSysAttributes):
|
||||
"""Send a discovery message to Home-Assistant."""
|
||||
message = Message(provider, component, platform, config)
|
||||
|
||||
# Allready exists?
|
||||
# Already exists?
|
||||
for exists_message in self.message_obj:
|
||||
if exists_message == message:
|
||||
_LOGGER.warning("Found douplicate discovery message from %s",
|
||||
|
@ -92,9 +92,9 @@ class SnapshotManager(CoreSysAttributes):
|
||||
if not await snapshot.load():
|
||||
return None
|
||||
|
||||
# Allready exists?
|
||||
# Already exists?
|
||||
if snapshot.slug in self.snapshots_obj:
|
||||
_LOGGER.error("Snapshot %s allready exists!", snapshot.slug)
|
||||
_LOGGER.error("Snapshot %s already exists!", snapshot.slug)
|
||||
return None
|
||||
|
||||
# Move snapshot to backup
|
||||
|
@ -137,7 +137,7 @@ class Snapshot(CoreSysAttributes):
|
||||
self._data[ATTR_CRYPTO] = CRYPTO_AES128
|
||||
|
||||
def set_password(self, password):
|
||||
"""Set the password for a exists snapshot."""
|
||||
"""Set the password for an existing snapshot."""
|
||||
if not password:
|
||||
return False
|
||||
|
||||
@ -210,7 +210,7 @@ class Snapshot(CoreSysAttributes):
|
||||
if not self.tarfile.is_file():
|
||||
return self
|
||||
|
||||
# extract a exists snapshot
|
||||
# extract an existing snapshot
|
||||
def _extract_snapshot():
|
||||
"""Extract a snapshot."""
|
||||
with tarfile.open(self.tarfile, "r:") as tar:
|
||||
@ -252,7 +252,7 @@ class Snapshot(CoreSysAttributes):
|
||||
addon_list = addon_list or self.sys_addons.list_installed
|
||||
|
||||
async def _addon_save(addon):
|
||||
"""Task to store a add-on into snapshot."""
|
||||
"""Task to store an add-on into snapshot."""
|
||||
addon_file = SecureTarFile(
|
||||
Path(self._tmp.name, f"{addon.slug}.tar.gz"),
|
||||
'w', key=self._key)
|
||||
@ -285,7 +285,7 @@ class Snapshot(CoreSysAttributes):
|
||||
addon_list.append(addon)
|
||||
|
||||
async def _addon_restore(addon):
|
||||
"""Task to restore a add-on into snapshot."""
|
||||
"""Task to restore an add-on into snapshot."""
|
||||
addon_file = SecureTarFile(
|
||||
Path(self._tmp.name, f"{addon.slug}.tar.gz"),
|
||||
'r', key=self._key)
|
||||
|
@ -25,7 +25,7 @@ def password_for_validating(password):
|
||||
|
||||
|
||||
def key_to_iv(key):
|
||||
"""Generate a iv from Key."""
|
||||
"""Generate an iv from Key."""
|
||||
for _ in range(100):
|
||||
key = hashlib.sha256(key).digest()
|
||||
return key[:16]
|
||||
|
@ -15,7 +15,7 @@ ALL_FOLDERS = [FOLDER_HOMEASSISTANT, FOLDER_SHARE, FOLDER_ADDONS, FOLDER_SSL]
|
||||
|
||||
|
||||
def unique_addons(addons_list):
|
||||
"""Validate that a add-on is unique."""
|
||||
"""Validate that an add-on is unique."""
|
||||
single = set([addon[ATTR_SLUG] for addon in addons_list])
|
||||
|
||||
if len(single) != len(addons_list):
|
||||
|
@ -23,7 +23,7 @@ class Supervisor(CoreSysAttributes):
|
||||
|
||||
@property
|
||||
def need_update(self):
|
||||
"""Return True if a update is available."""
|
||||
"""Return True if an update is available."""
|
||||
return self.version != self.last_version
|
||||
|
||||
@property
|
||||
|
@ -53,7 +53,7 @@ class Tasks(CoreSysAttributes):
|
||||
_LOGGER.info("All core tasks are scheduled")
|
||||
|
||||
async def _update_addons(self):
|
||||
"""Check if a update is available of a addon and update it."""
|
||||
"""Check if an update is available for an addon and update it."""
|
||||
tasks = []
|
||||
for addon in self.sys_addons.list_addons:
|
||||
if not addon.is_installed or not addon.auto_update:
|
||||
@ -77,7 +77,7 @@ class Tasks(CoreSysAttributes):
|
||||
if not self.sys_supervisor.need_update:
|
||||
return
|
||||
|
||||
# don't perform a update on beta/dev channel
|
||||
# don't perform an update on beta/dev channel
|
||||
if self.sys_dev:
|
||||
_LOGGER.warning("Ignore Hass.io update on dev channel!")
|
||||
return
|
||||
|
@ -81,7 +81,7 @@ class SecureTarFile:
|
||||
|
||||
|
||||
def _generate_iv(key, salt):
|
||||
"""Generate a iv from data."""
|
||||
"""Generate an iv from data."""
|
||||
temp_iv = key + salt
|
||||
for _ in range(100):
|
||||
temp_iv = hashlib.sha256(temp_iv).digest()
|
||||
|
Loading…
x
Reference in New Issue
Block a user