user1513388
user1513388

Reputation: 7451

Python Fabric NameError: global name 'log_action' is not defined

I'm trying to use the Fabric "log_action" method as documented here:

http://docs.fabfile.org/en/1.6/usage/fab.html#per-task-arguments

However it appear that the ""log_action" method has not been implemented.

Fabric 1.8.2, Paramiko 1.12.3

from fabric.api import run
from fabric.api import env
from fabric.api import sudo
from fabric.api import sudo, warn_only

def new_user(username, admin='no', comment="No comment provided"):
log_action("New User (%s): %s" % (username, comment))
pass

NameError: global name 'log_action' is not defined

Upvotes: 1

Views: 1784

Answers (1)

alecxe
alecxe

Reputation: 474071

Following @Andrew Wilkinsons's comment.

There is a bit of confusion in the documentation. The chapter is actually about passing arguments to fabric tasks, log_action call is not relevant and it is not a real function - it's just an example what you can possibly do inside the task.

Upvotes: 2

Related Questions