-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an option to podman machine init to declare the timezone of the resulting machine. the default is to use the value of the host name or else a given timezone name like America/Chicago. Fixes: #11895 Signed-off-by: Brent Baude <[email protected]> [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <[email protected]>
- Loading branch information
Showing
7 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//+build darwin | ||
|
||
package machine | ||
|
||
import ( | ||
"os" | ||
"strings" | ||
) | ||
|
||
func getLocalTimeZone() (string, error) { | ||
tzPath, err := os.Readlink("/etc/localtime") | ||
if err != nil { | ||
return "", err | ||
} | ||
return strings.TrimPrefix(tzPath, "/var/db/timezone/zoneinfo"), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package machine | ||
|
||
import ( | ||
"os/exec" | ||
"strings" | ||
) | ||
|
||
func getLocalTimeZone() (string, error) { | ||
output, err := exec.Command("timedatectl", "show", "--property=Timezone").Output() | ||
if err != nil { | ||
return "", err | ||
} | ||
// Remove prepended field and the newline | ||
return strings.TrimPrefix(strings.TrimSuffix(string(output), "\n"), "Timezone="), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters