summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Admin.py
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2015-07-24 23:38:04 +0200
committerSol Jerome <sol.jerome@gmail.com>2015-10-13 13:11:01 -0500
commit76ab7f6e8a2392a2dbe3d9cf4cf3c7399c6fa3f2 (patch)
tree497d4662b49285394dcc464bb3f7bcba615d602e /src/lib/Bcfg2/Server/Admin.py
parent64dc09e18b8a34d57c9ff6c64cc9656c1e65c29c (diff)
downloadbcfg2-76ab7f6e8a2392a2dbe3d9cf4cf3c7399c6fa3f2.tar.gz
bcfg2-76ab7f6e8a2392a2dbe3d9cf4cf3c7399c6fa3f2.tar.bz2
bcfg2-76ab7f6e8a2392a2dbe3d9cf4cf3c7399c6fa3f2.zip
Admin: Add expirecache command
Expirecache is now part of bcfg2-admin and will call expire_metadata_cache from Core via XML-RPC. This will expire the metadata cache of the supplied clients (or the complete cache if no arguments are supplied) on a running bcfg2-server.
Diffstat (limited to 'src/lib/Bcfg2/Server/Admin.py')
-rw-r--r--src/lib/Bcfg2/Server/Admin.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/Bcfg2/Server/Admin.py b/src/lib/Bcfg2/Server/Admin.py
index b038980a1..c32b1989b 100644
--- a/src/lib/Bcfg2/Server/Admin.py
+++ b/src/lib/Bcfg2/Server/Admin.py
@@ -443,6 +443,25 @@ class Compare(AdminCmd):
print("")
+class ExpireCache(_ProxyAdminCmd):
+ """ Expire the metadata cache """
+
+ options = _ProxyAdminCmd.options + [
+ Bcfg2.Options.PositionalArgument(
+ "hostname", nargs="*", default=[],
+ help="Expire cache for the given host(s)")]
+
+ def run(self, setup):
+ clients = None
+ if setup.hostname is not None and len(setup.hostname) > 0:
+ clients = setup.hostname
+
+ try:
+ self.proxy.expire_metadata_cache(clients)
+ except Bcfg2.Client.Proxy.ProxyError:
+ self.errExit("Proxy Error: %s" % sys.exc_info()[1])
+
+
class Init(AdminCmd):
"""Interactively initialize a new repository."""