<commit_before>package openstack

import (
	"errors"
	"fmt"
	"github.com/mitchellh/packer/packer"
	"time"
)

// RunConfig contains configuration for running an instance from a source
// image and details on how to access that launched image.
type RunConfig struct {
	SourceImage   string `mapstructure:"source_image"`
	Flavor        string `mapstructure:"flavor"`
	RawSSHTimeout string `mapstructure:"ssh_timeout"`
	SSHUsername   string `mapstructure:"ssh_username"`
	SSHPort       int    `mapstructure:"ssh_port"`

	// Unexported fields that are calculated from others
	sshTimeout time.Duration
}

func (c *RunConfig) Prepare(t *packer.ConfigTemplate) []error {
	if t == nil {
		var err error
		t, err = packer.NewConfigTemplate()
		if err != nil {
			return []error{err}
		}
	}

	// Defaults
	if c.SSHUsername == "" {
		c.SSHUsername = "root"
	}

	if c.SSHPort == 0 {
		c.SSHPort = 22
	}

	if c.RawSSHTimeout == "" {
		c.RawSSHTimeout = "1m"
	}

	// Validation
	var err error<commit_msg>Increase default SSH timeout for OpenStack from 1m -> 5m<commit_after>package openstack

import (
	"errors"
	"fmt"
	"github.com/mitchellh/packer/packer"
	"time"
)

// RunConfig contains configuration for running an instance from a source
// image and details on how to access that launched image.
type RunConfig struct {
	SourceImage   string `mapstructure:"source_image"`
	Flavor        string `mapstructure:"flavor"`
	RawSSHTimeout string `mapstructure:"ssh_timeout"`
	SSHUsername   string `mapstructure:"ssh_username"`
	SSHPort       int    `mapstructure:"ssh_port"`

	// Unexported fields that are calculated from others
	sshTimeout time.Duration
}

func (c *RunConfig) Prepare(t *packer.ConfigTemplate) []error {
	if t == nil {
		var err error
		t, err = packer.NewConfigTemplate()
		if err != nil {
			return []error{err}
		}
	}

	// Defaults
	if c.SSHUsername == "" {
		c.SSHUsername = "root"
	}

	if c.SSHPort == 0 {
		c.SSHPort = 22
	}

	if c.RawSSHTimeout == "" {
		c.RawSSHTimeout = "5m"
	}

	// Validation
	var err error
{'fraction_non_alphanumeric': 0.11182582879762494, 'fraction_numerical': 0.004948045522018802, 'mean_word_length': 3.6270022883295194, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '6488284', 'n_tokens_mistral': 734, 'n_tokens_neox': 683, 'n_words': 191}