fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fab-user] some question for fabric-from CHINA


From: g.t.lions
Subject: [Fab-user] some question for fabric-from CHINA
Date: Fri, 28 Sep 2012 16:28:58 +0800

hi,i'am a sa&dba,for do remote task i find fabric+py,this very good for me。
and i have question for help:
how could i run fabric task at any host?like this:when i finish a py script with fab,at host A,i can run python fabfile.py,it‘s work done and good。but i want make&complete the script with pyinstaller,it did work,raise error。

follow is this script:
address@hidden opt]# cat fabfile.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Name:
# Filename : NewPython.py

# What:

# Version:
# Release:   2012-9-26
# Author:    Gtlions
# Copyright: Copyright (c) Gtlions 2012 <address@hidden>  
# Licence:   <Gtlions's licence>
#-------------------------------------------------------------------------------
from fabric.api import *
env.hosts=['address@hidden','address@hidden','address@hidden']
env.passwords={'address@hidden':'hwttportal3','address@hidden':'hwttmcp','address@hidden':'rbtdev'}
def hostname():
    '''show hostname'''
        run('hostname')
def disk():
    '''show diskinfo'''
        run('df -h')

work good use pytho fabfile.py
address@hidden opt]# fab disk
[address@hidden] Executing task 'disk'
[address@hidden] run: df -h
[address@hidden] out: 文件系统              容量  已用 可用 已用% 挂载点
[address@hidden] out: /dev/cciss/c0d0p8     2.9G  933M  1.8G  34% /
[address@hidden] out: /dev/cciss/c0d0p9     609G  259G  319G  45% /usr
[address@hidden] out: /dev/cciss/c0d0p7     2.9G   70M  2.7G   3% /tmp
[address@hidden] out: /dev/cciss/c0d0p6     4.8G  4.1G  437M  91% /home
[address@hidden] out: /dev/cciss/c0d0p5     4.8G  180M  4.4G   4% /var/log
[address@hidden] out: /dev/cciss/c0d0p2      29G  6.6G   21G  25% /opt
[address@hidden] out: /dev/cciss/c0d0p1     2.9G   93M  2.6G   4% /boot
[address@hidden] out: tmpfs                 1.8G     0  1.8G   0% /dev/shm

[address@hidden] Executing task 'disk'
[address@hidden] run: df -h
[address@hidden] out: 文件系统              容量  已用 可用 已用% 挂载点
[address@hidden] out: /dev/mapper/VolGroup00-LogVol00
[address@hidden] out:                       130G   51G   73G  42% /
[address@hidden] out: /dev/sda1              99M   12M   82M  13% /boot
[address@hidden] out: tmpfs                 471M     0  471M   0% /dev/shm

[address@hidden] Executing task 'disk'
[address@hidden] run: df -h
[address@hidden] out: 文件系统              容量  已用 可用 已用% 挂载点
[address@hidden] out: /dev/sda1             6.8G  5.3G  1.2G  82% /
[address@hidden] out: tmpfs                 252M     0  252M   0% /dev/shm
[address@hidden] out: /dev/mapper/vgmain-lv_1
[address@hidden] out:                       9.9G  6.4G  3.0G  69% /usr/app


Done.
Disconnecting from address@hidden done.
Disconnecting from 192.168.2.3... done.
Disconnecting from 192.168.2.233... done.

raise error when i run it,with pyinstaller bulid it.
address@hidden opt]# ./fabfile
Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "/opt/pyinstaller/PyInstaller/loader/iu.py", line 409, in importHook
    raise ImportError("No module named %s" % fqname)
ImportError: No module named fabric

this problem may be like this:why can‘t run the script name is not named fabfile or fabfile.py;and how user the args -f?
thk’s all!

叶子

reply via email to

[Prev in Thread] Current Thread [Next in Thread]