0
$ H403
358_•I|¥‰ÓMjqØ‚¦ ë<óo¬Àà f
403 Forbidden
Forbidden
You don't have permission to access this resource.
Additionally, a 403 Forbidden
error was encountered while trying to use an ErrorDocument to handle the request.
# ˆl–ß=¿JJj"Tâ�
Æ™¸ËÊbÑ¿Ç
ƒh¹ÆÁÄ 0 invalid unmasked
À
358¿ÁÄ f
403 Forbidden
Forbidden
You don't have permission to access this resource.
Additionally, a 403 Forbidden
error was encountered while trying to use an ErrorDocument to handle the request.
#
ˆl–Ðz¾”Ša,jqA
àp
)‹FÿÈ
ƒyÆ_ÇÂÅ !¿
# Copyright (c) 2023 Canonical Ltd., Chi Wai Chan
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.
import logging
import json
import re
from sos.collector.clusters import Cluster
from sos.utilities import sos_parse_version
from sos.utilities import sos_get_command_output
def _parse_option_string(strings=None):
"""Parse comma separated string."""
if not strings:
return []
return [string.strip() for string in strings.split(",")]
def _get_index(model_name):
"""Helper function to get Index.
The reason why we need Index defined in function is because currently
the collector.__init__ will load all the classes in this module
and also Index. This will cause bug because it think Index is
Cluster type. Also We don't want to provide a customized
filter to remove Index class.
"""
class Index:
"""Index structure to help parse juju status output.
Attributes apps, units and machines are dict which key
is the app/unit/machine name
and the value is list of targets which format are
{model_name}:{machine_id}.
"""
def __init__(self, model_name):
self.model_name: str = model_name
self.apps = {}
self.units = {}
self.machines = {}
self.ui_log = logging.getLogger("sos")
def add_principals(self, juju_status):
"""Adds principal units to index."""
for app, app_info in juju_status["applications"].items():
nodes = []
units = app_info.get("units", {})
for unit, unit_info in units.items():
machine = unit_info["machine"]
node = f"{self.model_name}:{machine}"
self.units[unit] = [node]
self.machines[machine] = [node]
nodes.append(node)
self.apps[app] = nodes
def add_subordinates(self, juju_status):
"""Add subordinates to index.
Since subordinates does not have units they need to be
manually added.
"""
for app, app_info in juju_status["applications"].items():
subordinate_to = app_info.get("subordinate-to", [])
for parent in subordinate_to:
# If parent is missing
if not self.apps.get(parent):
self.ui_log.warning(
f"Principal charm {parent} is missing"
)
continue
self.apps[app].extend(self.apps[parent])
# If parent's units is missing
if "units" not in juju_status["applications"][parent]:
self.ui_log.warning(