Hi,
I am running the below Fabric version and when i execute the below fabric python code i
$fab -V
Fabric 2.0.1
Paramiko 2.4.1
Invoke 1.0.0
$
#!/usr/bin/env python
from fabric.api import *
# Set the username
env.user = "root"
# Set the password [NOT RECOMMENDED]
env.password = "Apigee123!"
out_log = open("output.txt", "w")
with open("hosts.txt") as host_file:
host_list = [x.strip() for x in host_file.readlines()]
@hosts(host_list)
def rpm():
with settings(warn_only=True):
version = run("rpm -qa | grep libdb4")
out_log.write("%s: %s" % (env.host, version))
$fab rpm
Traceback (most recent call last):
File "/usr/local/bin/fab", line 11, in <module>
load_entry_point('fabric==2.0.1', 'console_scripts', 'fab')()
File "/usr/local/Cellar/fabric/2.0.1/libexec/lib/python2.7/site-packages/invoke/program.py", line 321, in run
self.parse_collection()
File "/usr/local/Cellar/fabric/2.0.1/libexec/lib/python2.7/site-packages/invoke/program.py", line 399, in parse_collection
self.load_collection()
File "/usr/local/Cellar/fabric/2.0.1/libexec/lib/python2.7/site-packages/fabric/main.py", line 74, in load_collection
super(Fab, self).load_collection()
File "/usr/local/Cellar/fabric/2.0.1/libexec/lib/python2.7/site-packages/invoke/program.py", line 588, in load_collection
module, parent = loader.load(coll_name)
File "/usr/local/Cellar/fabric/2.0.1/libexec/lib/python2.7/site-packages/invoke/loader.py", line 75, in load
module = imp.load_module(name, fd, path, desc)
File "/Users/kaushalshriyan/singaporetraining/fabfile.py", line 2, in <module>
from fabric.api import *
ImportError: No module named api
Any help will be highly appreciable. Thanks in Advance.
Best Regards,
Kaushal