Exemplo n.º 1
0
    def __init__(self, id=None, api=None, timeout=None):
        if not api:
            api = os.environ.get('CS_API_URL', DEFAULT_CS_API_URL)
        if not timeout:
            timeout = float(os.environ.get('CS_API_TIMEOUT', DEFAULT_TIMEOUT))
        self.id = None
        self.name = None
        self.owner = None
        self.series = None
        self.maintainer = None
        self.revision = None
        self.url = None

        self.approved = False
        self.tags = None
        self.source = None

        self.files = []

        self.stats = {}

        self.raw = {}
        self.theblues = charmstore.CharmStore(url=api, timeout=timeout)

        if id:
            self.load(
                self.theblues._meta(id.replace('cs:', ''),
                                    AVAILABLE_INCLUDES).get('Meta')
            )
def get_revisions(name: str) -> List[Tuple[str, str]]:
    charm = charmstore.CharmStore().search(name)[0]
    latest = charm.revision
    print("{} revisions for charm: {}".format(latest, name))

    cs = theblues.charmstore.CharmStore()

    results = []
    for a in range(1, int(latest)):
        print(".", end="", flush=True)
        try:
            results.append(("{}/{}".format(name, a), (cs.entity("{}-{}".format(
                name, a))['Meta']['extra-info']['vcs-revisions'][0]['date'])))
        except Exception as e:
            print("Exception was: {}".format(str(e)))
            pass
    print()
    return results
Exemplo n.º 3
0
    def __init__(self, id=None, timeout=DEFAULT_TIMEOUT):
        self.id = None
        self.name = None
        self.owner = None
        self.series = None
        self.maintainer = None
        self.revision = None
        self.url = None

        self.approved = False
        self.tags = None
        self.source = None

        self.files = []

        self.stats = {}

        self.raw = {}
        self.theblues = charmstore.CharmStore(timeout=timeout)

        if id:
            self.load(
                self.theblues._meta(id.replace('cs:', ''),
                                    AVAILABLE_INCLUDES).get('Meta'))
Exemplo n.º 4
0
 def __init__(self, api='https://api.jujucharms.com/v4'):
     super(CharmStore, self).__init__()
     self.theblues = charmstore.CharmStore(api)
Exemplo n.º 5
0
 def __init__(self, api=None):
     super(CharmStore, self).__init__()
     if not api:
         api = os.environ.get('CS_API_URL', DEFAULT_CS_API_URL)
     self.theblues = charmstore.CharmStore(url=api)
Exemplo n.º 6
0
 def __init__(self, loop):
     self.loop = loop
     self._cs = charmstore.CharmStore()