Hi,
I must not understand the usage of roles. Given:
from fabric.api import *
from fabric.state import output
from fabric.decorators import roles
env.hosts =
['us...@remotesever1:22','us...@remoteserver2:7722','us...@remoteserver3
','us...@remoteserver4']
env.roledefs = {
'deploy':
['us...@remotesever1:22','us...@remoteserver2:7722','us...@remoteserver3
'],
'stage': ['us...@remoteserver4'],
}
env.key_filename = '/path/to/known_hosts'
def pack():
"""do some local stuff"""
print("Executing pack on %(host)s as %(user)s" % env)
@roles('stage')
def update_staging():
"""update the staging server"""
print("Executing update_staging on %(host)s as %(user)s" % env)
@roles('deploy')
def update_production():
"""update the production servers"""
print("Executing update_production on %(host)s as %(user)s" % env)
def go():
pack()
update_staging()
update_production()
I would expect update_staging to only be acted on by the 'stage'
roledef and the update_production by the 'deploy' roledef.
Any help would be very appreciated:)
_______________________________________________
Fab-user mailing list
Fab-user@nongnu.org
http://lists.nongnu.org/mailman/listinfo/fab-user