Commit 6a94baf7 authored by Max Wittig's avatar Max Wittig Committed by Max Wittig

feat(parallels): allow the timeserver to be customizable

parent 4e7f4b34
......@@ -112,6 +112,7 @@ type ParallelsConfig struct {
BaseName string `toml:"base_name" json:"base_name" long:"base-name" env:"PARALLELS_BASE_NAME" description:"VM name to be used"`
TemplateName string `toml:"template_name,omitempty" json:"template_name" long:"template-name" env:"PARALLELS_TEMPLATE_NAME" description:"VM template to be created"`
DisableSnapshots bool `toml:"disable_snapshots,omitzero" json:"disable_snapshots" long:"disable-snapshots" env:"PARALLELS_DISABLE_SNAPSHOTS" description:"Disable snapshoting to speedup VM creation"`
TimeServer string `toml:"time_server,omitempty" json:"time_server" long:"time-server" env:"PARALLELS_TIME_SERVER" description:"Timeserver to sync the guests time from. Defaults to time.apple.com"`
}
type VirtualBoxConfig struct {
......
......@@ -265,10 +265,14 @@ func (s *executor) Prepare(options common.ExecutorPrepareOptions) error {
// Unable to open new session in this virtual machine.
// Make sure the latest version of Parallels Tools is installed in this virtual machine and it has finished booting
s.Debugln("Updating VM date...")
err = prl.TryExec(s.vmName, 20, "sudo", "ntpdate", "-u", "time.apple.com")
timeServer := s.Config.Parallels.TimeServer
if timeServer == "" {
timeServer = "time.apple.com"
}
err = prl.TryExec(s.vmName, 20, "sudo", "ntpdate", "-u", timeServer)
if err != nil {
s.Debugln("Could not run ntpdate command. Trying the sntp command instead...")
err = prl.TryExec(s.vmName, 20, "sudo", "sntp", "-S", "time.apple.com")
err = prl.TryExec(s.vmName, 20, "sudo", "sntp", "-S", timeServer)
if err != nil {
s.Println("Could not sync with timeserver!")
return err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment