forked from dell/redfish-ansible-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.py
34 lines (28 loc) · 1.04 KB
/
uninstall.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python
# _*_ coding: utf-8 _*_
# Copyright © 2017-2018 Dell EMC Inc.
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
# This script uninstalls the Ansible modules from their default location.
import os
import sys
import shutil
try:
import ansible
except ImportError:
print "Error: Ansible is not installed"
sys.exit(1)
ansible_path = ansible.__path__[0]
redfish_module_path = ansible_path + '/modules/remote_management/redfish'
module_utils_path = ansible_path + '/module_utils/'
redfish_utils_file = module_utils_path + 'redfish_utils.py'
redfish_utils_bytecode = module_utils_path + 'redfish_utils.pyc'
if os.path.isdir(redfish_module_path):
shutil.rmtree(redfish_module_path)
print("Removing %s" % redfish_module_path)
if os.path.isfile(redfish_utils_file):
os.remove(redfish_utils_file)
print("Removing %s" % redfish_utils_file)
if os.path.isfile(redfish_utils_bytecode):
os.remove(redfish_utils_bytecode)
print("Removing %s" % redfish_utils_bytecode)
print("Done")