@@ -194,13 +194,16 @@ def _known_hosts_outdated(local_filename, remote_filename):
194194return local_checksum != remote_checksum
195195
196196
197- def _set_gateway (name ):
197+ def _set_gateway (name , draft = False ):
198198"""
199199 Set the remote gateway box by environment name. Sets the Fabric env.gateway
200200 setting and makes sure that the correct known_hosts file will be consulted,
201201 then dynamically fetches a list of hosts from the gateway box.
202202 """
203- env .gateway = 'jumpbox.{0}.alphagov.co.uk' .format (name )
203+ if draft :
204+ env .gateway = 'jumpbox.draft.{0}.publishing.service.gov.uk' .format (name )
205+ else :
206+ env .gateway = 'jumpbox.{0}.alphagov.co.uk' .format (name )
204207env .system_known_hosts = _fetch_known_hosts ()
205208env .roledefs .fetch ()
206209
@@ -219,16 +222,31 @@ def production():
219222"""Select production environment"""
220223_set_gateway ('production' )
221224
225+ @task
226+ def draft_production ():
227+ """Select draft production environment"""
228+ _set_gateway ('production' ,draft = True )
229+
222230@task
223231def staging ():
224232"""Select staging environment"""
225233_set_gateway ('staging' )
226234
235+ @task
236+ def draft_staging ():
237+ """Select draft staging environment"""
238+ _set_gateway ('staging' ,draft = True )
239+
227240@task
228241def preview ():
229242"""Select preview environment"""
230243_set_gateway ('preview' )
231244
245+ @task
246+ def draft_preview ():
247+ """Select draft preview environment"""
248+ _set_gateway ('preview' ,draft = True )
249+
232250@task
233251def all ():
234252"""Select all machines in current environment"""