<commit_before>package main

import (
	"fmt"
	"github.com/Symantec/Dominator/imagepublishers/amipublisher"
	"github.com/Symantec/Dominator/lib/awsutil"
	"github.com/Symantec/Dominator/lib/log"
	"os"
	"path"
)

func launchInstancesSubcommand(args []string, logger log.Logger) {
	domImage := ""
	if len(args) > 1 {
		domImage = args[1]
	}
	err := launchInstances(args[0], domImage, logger)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error copying bootstrap images: %s\n", err)
		os.Exit(1)
	}
	os.Exit(0)
}

func launchInstances(bootImage, domImage string, logger log.Logger) error {
	bootImage = path.Clean(bootImage)
	tags, err := makeTags()
	if err != nil {
		return err
	}
	tags["Name"] = *unpackerName
	if domImage != "" {
		tags["RequiredImage"] = domImage
	}
	imageTags := make(awsutil.Tags)
	for key, value := range searchTags {
		imageTags[key] = value
	}
	imageTags["Name"] = bootImage
	return amipublisher.LaunchInstances(targets, skipTargets, imageTags,
		subnetSearchTags, vpcSearchTags, securityGroupSearchTags,
		*instanceType, *sshKeyName, tags, logger)
}<commit_msg>Fix bug in launch-instances subcommand of ami-publisher.<commit_after>package main

import (
	"fmt"
	"github.com/Symantec/Dominator/imagepublishers/amipublisher"
	"github.com/Symantec/Dominator/lib/awsutil"
	"github.com/Symantec/Dominator/lib/log"
	"os"
	"path"
)

func launchInstancesSubcommand(args []string, logger log.Logger) {
	domImage := ""
	if len(args) > 1 {
		domImage = args[1]
	}
	err := launchInstances(args[0], domImage, logger)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error launching instances: %s\n", err)
		os.Exit(1)
	}
	os.Exit(0)
}

func launchInstances(bootImage, domImage string, logger log.Logger) error {
	bootImage = path.Clean(bootImage)
	tags, err := makeTags()
	if err != nil {
		return err
	}
	tags["Name"] = *unpackerName
	if domImage != "" {
		tags["RequiredImage"] = domImage
	}
	imageTags := make(awsutil.Tags)
	for key, value := range searchTags {
		imageTags[key] = value
	}
	imageTags["Name"] = bootImage
	return amipublisher.LaunchInstances(targets, skipTargets, imageTags,
		vpcSearchTags, subnetSearchTags, securityGroupSearchTags,
		*instanceType, *sshKeyName, tags, logger)
}
{'fraction_non_alphanumeric': 0.13772727272727273, 'fraction_numerical': 0.004545454545454545, 'mean_word_length': 4.900804289544236, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6870587', 'n_tokens_mistral': 833, 'n_tokens_neox': 812, 'n_words': 167}