def create_instance(options):
 project = get_project(options)
 print 'Creating instance {project}/{zone}/{instance}'.format(project=project, zone=get_zone(options), instance=options.instance)
 print '  with --machine_type={type} and --disk_size={disk_size}...'.format(type=options.machine_type, disk_size=options.disk_size)
 google_dev_dir = os.path.join(os.path.dirname(__file__), '../google/dev')
 dev_dir = os.path.dirname(__file__)
 project_dir = os.path.join(dev_dir, '..')
 install_dir = '{dir}/../install'.format(dir=dev_dir)
 startup_command = ['/opt/spinnaker/install/install_spinnaker.sh --dependencies_only', '/opt/spinnaker/install/install_development.sh']
 (fd, temp_startup) = tempfile.mkstemp()
 os.write(fd, ';'.join(startup_command))
 os.close(fd)
 metadata_files = ['startup-script={google_dev_dir}/google_install_loader.py,sh_bootstrap_dev={dev_dir}/bootstrap_dev.sh,sh_install_spinnaker={project_dir}/InstallSpinnaker.sh,sh_install_development={dev_dir}/install_development.sh,startup_command={temp_startup}'.format(google_dev_dir=google_dev_dir, dev_dir=dev_dir, project_dir=project_dir, temp_startup=temp_startup)]
 metadata = ','.join(['startup_loader_files=sh_install_spinnaker+sh_install_development+sh_bootstrap_dev'])
 command = ['gcloud', 'compute', 'instances', 'create', options.instance, '--project', get_project(options), '--zone', get_zone(options), '--machine-type', options.machine_type, '--image', 'ubuntu-14-04', '--scopes', 'compute-rw,storage-rw', '--boot-disk-size={size}'.format(size=options.disk_size), '--boot-disk-type={type}'.format(type=options.disk_type), '--metadata', metadata, '--metadata-from-file={files}'.format(files=','.join(metadata_files))]
 if options.address:
  command.extend(['--address', options.address])
 check_run_quick(' '.join(command), echo=False)

def create_instance ( options ) : project = get_project ( options ) print 'Creating instance {project}/{zone}/{instance}' . format ( project = project , zone = get_zone ( options ) , instance = options . instance ) print '  with --machine_type={type} and --disk_size={disk_size}...' . format ( type = options . machine_type , disk_size = options . disk_size ) google_dev_dir = os . path . join ( os . path . dirname ( __file__ ) , '../google/dev' ) dev_dir = os . path . dirname ( __file__ ) project_dir = os . path . join ( dev_dir , '..' ) install_dir = '{dir}/../install' . format ( dir = dev_dir ) startup_command = [ '/opt/spinnaker/install/install_spinnaker.sh --dependencies_only' , '/opt/spinnaker/install/install_development.sh' ] ( fd , temp_startup ) = tempfile . mkstemp ( ) os . write ( fd , ';' . join ( startup_command ) ) os . close ( fd ) metadata_files = [ 'startup-script={google_dev_dir}/google_install_loader.py,sh_bootstrap_dev={dev_dir}/bootstrap_dev.sh,sh_install_spinnaker={project_dir}/InstallSpinnaker.sh,sh_install_development={dev_dir}/install_development.sh,startup_command={temp_startup}' . format ( google_dev_dir = google_dev_dir , dev_dir = dev_dir , project_dir = project_dir , temp_startup = temp_startup ) ] metadata = ',' . join ( [ 'startup_loader_files=sh_install_spinnaker+sh_install_development+sh_bootstrap_dev' ] ) command = [ 'gcloud' , 'compute' , 'instances' , 'create' , options . instance , '--project' , get_project ( options ) , '--zone' , get_zone ( options ) , '--machine-type' , options . machine_type , '--image' , 'ubuntu-14-04' , '--scopes' , 'compute-rw,storage-rw' , '--boot-disk-size={size}' . format ( size = options . disk_size ) , '--boot-disk-type={type}' . format ( type = options . disk_type ) , '--metadata' , metadata , '--metadata-from-file={files}' . format ( files = ',' . join ( metadata_files ) ) ] if options . address : command . extend ( [ '--address' , options . address ] ) check_run_quick ( ' ' . join ( command ) , echo = False )
the generic script can be customised by using parameters .