async def connect_juju(ctrl_name=None, model_name=None, endpoint=None, username=None, password=None, cacert=None): controller = Controller(max_frame_size=MAX_FRAME_SIZE) # noqa if endpoint: await controller.connect(endpoint=endpoint, username=username, password=password, cacert=cacert) else: await controller.connect(ctrl_name) if endpoint: model = Model(max_frame_size=MAX_FRAME_SIZE) await model.connect(uuid=model_name, endpoint=endpoint, username=username, password=password, cacert=cacert) elif model_name: model = await controller.get_model(model_name) else: model = Model(max_frame_size=MAX_FRAME_SIZE) # noqa await model.connect() # HACK low unsettable timeout in the model model.charmstore._cs = CharmStore(timeout=60) return controller, model
import collections import gfm import os import re from jujubundlelib import references from theblues.charmstore import CharmStore from theblues.errors import EntityNotFound, ServerError from theblues.terms import Terms cs = CharmStore() terms = Terms("https://api.jujucharms.com/terms/") SEARCH_LIMIT = 400 def search_entities( query, entity_type=None, tags=None, sort=None, series=None, owner=None, promulgated_only=None, ): includes = [ "charm-metadata", "bundle-metadata", "owner", "bundle-unit-count",
from flask import Blueprint, render_template, abort, current_app from theblues.charmstore import CharmStore from pprint import pformat jaasstore = Blueprint('jaasstore', __name__, template_folder='/templates', static_folder='/static') cs = CharmStore("https://api.jujucharms.com/v5") @jaasstore.route('/store') def store(): return render_template('store/store.html') @jaasstore.route('/<entity_name>') def details(entity_name): try: entity = cs.entity(entity_name) entity_formatted = pformat(entity, 1, 120) except Exception: return abort(404, "Entity not found {}".format(entity_name)) return render_template('store/details.html', entity=entity_formatted)
import collections import os import re import markdown from mdx_gfm import GithubFlavoredMarkdownExtension from jujubundlelib import references from theblues.charmstore import CharmStore from theblues.errors import EntityNotFound, ServerError from theblues.terms import Terms cs = CharmStore(timeout=5) terms = Terms("https://api.jujucharms.com/terms/") SEARCH_LIMIT = 400 markdown = markdown.Markdown(extensions=[GithubFlavoredMarkdownExtension()]) def search_entities( query, entity_type=None, tags=None, sort=None, series=None, owner=None, promulgated_only=None, ): includes = [ "charm-metadata", "bundle-metadata",
def setUp(self): self.cs = CharmStore('http://example.com')
# Copyright (c) 2015 Canonical Ltd. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. """ Charm utilities Simple wrapper around theblues charmstore client Api for the charmstore: https://github.com/juju/charmstore/blob/v4/docs/API.md """ from theblues.charmstore import CharmStore cs = CharmStore('https://api.jujucharms.com/v4')