1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 import sys
19
20 try:
21
22 import xmlrpclib
23 except ImportError:
24
25 import xmlrpc.client as xmlrpclib
26 from spacewalk.common.rhnLog import log_error
27
28
30
31 - def __init__(self, host="127.0.0.1", port="2828"):
32 self.addr = "http://%s:%s" % (host, port)
33
34 - def notify(self, indexName="server"):
35 try:
36 client = xmlrpclib.ServerProxy(self.addr)
37 result = client.admin.updateIndex(indexName)
38 except Exception:
39 e = sys.exc_info()[1]
40 log_error("Failed to notify search service located at %s to update %s indexes"
41 % (self.addr, indexName), e)
42 return False
43 return result
44
45 if __name__ == "__main__":
46 search = SearchNotify()
47 result = search.notify()
48 print("search.notify() = %s" % (result))
49