Bug #47

avatar

env.hosts should be a list initially.

Added by Stavros Korokithakis 396 days ago. Updated 304 days ago.

Status:Done Start:08/09/2009
Priority:Normal Due date:
Assigned to:avatarJeff Forcier % Done:

100%

Category:Core
Target version:0.9

Description

I would like to have commands to append hosts in the host env variable, sort of like:

def production():
    env.hosts.append("production.com")

def staging():
    env.hosts.append("staging.com")

Right now, however, env.hosts is None, so I need to check and assign a list to it every time. It should be a list initially so we can just append to it.


Associated revisions

Revision fe80a6538843ad6213f4de0b69c5889581a5408e
Added by Jeff Forcier 395 days ago

Update role/host initialization logic.

  • fixes #47 by setting env.roles, env.hosts to empty lists.
  • fixes #31 by actually merging in env.roles (was omitting it, ugh)

History

Updated by Jeff Forcier 395 days ago

avatar
  • Assigned to set to Jeff Forcier
  • Target version set to 1.0

Will have to double check to make sure there’s no specific reason for this (unlikely but possible) and assuming nothing would be broken by making this change, it’s definitely a good idea.

Updated by Jeff Forcier 395 days ago

avatar
  • Target version changed from 1.0 to 0.9

Updated by Stavros Korokithakis 395 days ago

avatar

If any checks that require env.hosts to be empty check for “if not env.hosts” instead of “if env.hosts is None”, there shouldn’t be any problems. I'd try myself, but git is a bit of a large barrier to entry when you’re in Windows :/

Updated by Jeff Forcier 395 days ago

avatar

I mostly meant “is there an actual reason for it to be None instead of an empty list”, i.e. if in some corner of the code an empty host list meant something distinct from a None host list. Not that I can think of any such spots — I'm just really paranoid :)

Updated by Stavros Korokithakis 395 days ago

avatar

A paranoid coder is a good coder! Aren’t there unit tests?

Updated by Jeff Forcier 395 days ago

avatar

Some, but not nearly enough, something I plan to work on for Fab 1.0 (originally for 0.9 but I really need to get it out ASAP). Will actually be writing some more today in a “try to test before you bugfix” approach, but for a different issue than this one :)

Updated by Jeff Forcier 395 days ago

avatar
  • Status changed from New to Done
  • % Done changed from 0 to 100

Updated by Jeff Forcier 304 days ago

avatar
  • Category set to Core

Also available in: Atom