Revision 414ebaf1 lib/rapi/client.py
b/lib/rapi/client.py | ||
---|---|---|
1620 | 1620 |
("/%s/groups/%s/assign-nodes" % |
1621 | 1621 |
(GANETI_RAPI_VERSION, group)), query, body) |
1622 | 1622 |
|
1623 |
def GetGroupTags(self, group): |
|
1624 |
"""Gets tags for a node group. |
|
1625 |
|
|
1626 |
@type group: string |
|
1627 |
@param group: Node group whose tags to return |
|
1628 |
|
|
1629 |
@rtype: list of strings |
|
1630 |
@return: tags for the group |
|
1631 |
|
|
1632 |
""" |
|
1633 |
return self._SendRequest(HTTP_GET, |
|
1634 |
("/%s/groups/%s/tags" % |
|
1635 |
(GANETI_RAPI_VERSION, group)), None, None) |
|
1636 |
|
|
1637 |
def AddGroupTags(self, group, tags, dry_run=False): |
|
1638 |
"""Adds tags to a node group. |
|
1639 |
|
|
1640 |
@type group: str |
|
1641 |
@param group: group to add tags to |
|
1642 |
@type tags: list of string |
|
1643 |
@param tags: tags to add to the group |
|
1644 |
@type dry_run: bool |
|
1645 |
@param dry_run: whether to perform a dry run |
|
1646 |
|
|
1647 |
@rtype: string |
|
1648 |
@return: job id |
|
1649 |
|
|
1650 |
""" |
|
1651 |
query = [("tag", t) for t in tags] |
|
1652 |
if dry_run: |
|
1653 |
query.append(("dry-run", 1)) |
|
1654 |
|
|
1655 |
return self._SendRequest(HTTP_PUT, |
|
1656 |
("/%s/groups/%s/tags" % |
|
1657 |
(GANETI_RAPI_VERSION, group)), query, None) |
|
1658 |
|
|
1659 |
def DeleteGroupTags(self, group, tags, dry_run=False): |
|
1660 |
"""Deletes tags from a node group. |
|
1661 |
|
|
1662 |
@type group: str |
|
1663 |
@param group: group to delete tags from |
|
1664 |
@type tags: list of string |
|
1665 |
@param tags: tags to delete |
|
1666 |
@type dry_run: bool |
|
1667 |
@param dry_run: whether to perform a dry run |
|
1668 |
@rtype: string |
|
1669 |
@return: job id |
|
1670 |
|
|
1671 |
""" |
|
1672 |
query = [("tag", t) for t in tags] |
|
1673 |
if dry_run: |
|
1674 |
query.append(("dry-run", 1)) |
|
1675 |
|
|
1676 |
return self._SendRequest(HTTP_DELETE, |
|
1677 |
("/%s/groups/%s/tags" % |
|
1678 |
(GANETI_RAPI_VERSION, group)), query, None) |
|
1679 |
|
|
1623 | 1680 |
def Query(self, what, fields, filter_=None): |
1624 | 1681 |
"""Retrieves information about resources. |
1625 | 1682 |
|
Also available in: Unified diff