Skip to content

2.2.0 'Task' object has no attribute 'hosts' #1824

Description

@ilovezfs
  test do
    (testpath/"fabfile.py").write <<~EOS
      from invoke import task
      import fabric
      @task
      def hello(c):
        c.run("echo {}".format(fabric.__version__))
    EOS
    assert_equal version.to_s, shell_output("#{bin}/fab hello").chomp
  end
bash-3.2$ cat fabfile.py 
from invoke import task
import fabric
@task
def hello(c):
  c.run("echo {}".format(fabric.__version__))
==> /usr/local/Cellar/fabric/2.2.0/bin/fab hello
Traceback (most recent call last):
  File "/usr/local/Cellar/fabric/2.2.0/bin/fab", line 11, in <module>
    load_entry_point('fabric==2.2.0', 'console_scripts', 'fab')()
  File "/usr/local/Cellar/fabric/2.2.0/libexec/lib/python2.7/site-packages/invoke/program.py", line 335, in run
    self.execute()
  File "/usr/local/Cellar/fabric/2.2.0/libexec/lib/python2.7/site-packages/invoke/program.py", line 491, in execute
    executor.execute(*self.tasks)
  File "/usr/local/Cellar/fabric/2.2.0/libexec/lib/python2.7/site-packages/invoke/executor.py", line 95, in execute
    expanded = self.expand_calls(calls)
  File "/usr/local/Cellar/fabric/2.2.0/libexec/lib/python2.7/site-packages/fabric/executor.py", line 62, in expand_calls
    cxn_params = self.normalize_hosts(cli_hosts or call.hosts)
  File "/usr/local/Cellar/fabric/2.2.0/libexec/lib/python2.7/site-packages/invoke/tasks.py", line 396, in __getattr__
    return getattr(self.task, name)
AttributeError: 'Task' object has no attribute 'hosts'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions