3 # Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org)
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 from __future__ import print_function
20 import sys, os, hashlib
23 print(*objs, file=sys.stderr)
26 warning("Syntax: %s <identity>" % (sys.argv[0]))
31 inventory_file = "@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/lib/icinga2/agent/inventory/" + hashlib.sha256(cn).hexdigest()
33 if not os.path.isfile(inventory_file):
34 warning("There's no inventory file for agent '%s'." % (cn))
37 os.unlink(inventory_file)
39 peer_file = "@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/lib/icinga2/agent/inventory/" + hashlib.sha256(cn).hexdigest() + ".peer"
41 if os.path.isfile(peer_file):
44 print("Inventory information has been removed for agent '%s'." % (cn))