Ejemplo n.º 1
0
    def from_name(cls, name):
        """ Retrieve a disk id associated to a name. """
        disks = cls.list({'name': name})
        if len(disks) == 1:
            return disks[0]['id']
        elif not disks:
            return

        raise DuplicateResults('disk name %s is ambiguous.' % name)
Ejemplo n.º 2
0
    def from_name(cls, name):
        """ Retrieve a snapshot profile accsociated to a name."""
        snps = cls.list({'name': name})
        if len(snps) == 1:
            return snps[0]['id']
        elif not snps:
            return

        raise DuplicateResults('snapshot profile name %s is ambiguous.' % name)
Ejemplo n.º 3
0
    def info(cls, resource):
        """Display information about a snapshot profile."""
        snps = cls.list({'id': cls.usable_id(resource)})
        if len(snps) == 1:
            return snps[0]
        elif not snps:
            return

        raise DuplicateResults('snapshot profile %s is ambiguous.' % resource)
Ejemplo n.º 4
0
    def from_name(cls, name):
        """Retrieve a sshkey id associated to a name."""
        sshkeys = cls.list({'name': name})
        if len(sshkeys) == 1:
            return sshkeys[0]['id']
        elif not sshkeys:
            return

        raise DuplicateResults('sshkey name %s is ambiguous.' % name)