����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, XLAB Steampunk <steampunk@xlab.si>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from . import errors, http
def get(path):
url = "https://bonsai.sensu.io/api/v1/assets/{0}".format(path)
resp = http.request("GET", url)
if resp.status != 200:
raise errors.BonsaiError(
"Server returned status {0}".format(resp.status),
)
if resp.json is None:
raise errors.BonsaiError("Server returned invalid JSON document")
return resp.json
def get_available_asset_versions(namespace, name):
asset_data = get("{0}/{1}".format(namespace, name))
try:
return set(v["version"] for v in asset_data["versions"])
except (TypeError, KeyError):
raise errors.BonsaiError(
"Cannot extract versions from {0}".format(asset_data),
)
def get_asset_version_builds(namespace, name, version):
asset = get("{0}/{1}/{2}/release_asset_builds".format(
namespace, name, version,
))
if "spec" not in asset or "builds" not in asset["spec"]:
raise errors.BonsaiError("Invalid build spec: {0}".format(asset))
return asset
def get_asset_parameters(name, version):
try:
namespace, asset_name = name.split("/")
except ValueError:
raise errors.BonsaiError(
"Bonsai asset names should be formatted as <namespace>/<name>.",
)
available_versions = get_available_asset_versions(namespace, asset_name)
if version not in available_versions:
raise errors.BonsaiError(
"Version {0} is not available. Choose from: {1}.".format(
version, ", ".join(available_versions),
),
)
asset_builds = get_asset_version_builds(namespace, asset_name, version)
return dict(
labels=asset_builds.get("metadata", {}).get("labels"),
annotations=asset_builds.get("metadata", {}).get("annotations"),
builds=asset_builds["spec"]["builds"],
)
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| arguments.py | File | 3.27 KB | 0644 |
|
| bonsai.py | File | 2.09 KB | 0644 |
|
| client.py | File | 4.48 KB | 0644 |
|
| debug.py | File | 1.65 KB | 0644 |
|
| errors.py | File | 719 B | 0644 |
|
| http.py | File | 2.29 KB | 0644 |
|
| role_utils.py | File | 2.12 KB | 0644 |
|
| utils.py | File | 4.94 KB | 0644 |
|