Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
amritakohli committed Dec 18, 2024
1 parent e764f81 commit 8d45b60
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion toolkit/tools/imagecustomizerapi/disksize.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func parseDiskSize(diskSizeString string) (DiskSize, error) {
return DiskSize(num), nil
}

// String returns the string representation of the DiskSize in the most appropriate unit
// String returns the string representation of DiskSize in the most appropriate unit
// such that it matches the input format.
func (s DiskSize) String() string {
switch {
Expand Down
1 change: 1 addition & 0 deletions toolkit/tools/imagecustomizerapi/partitionsize.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func (s PartitionSize) MarshalJSON() ([]byte, error) {

func (s *PartitionSize) UnmarshalJSON(data []byte) error {
var err error

var stringValue string
err = json.Unmarshal(data, &stringValue)
if err != nil {
Expand Down
7 changes: 4 additions & 3 deletions toolkit/tools/pkg/imagecustomizerlib/imagehistory.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,26 @@ type ImageHistory struct {
func addImageHistory(imageChroot *safechroot.Chroot, imageUuid string, baseConfigPath string, toolVersion string, buildTime string, config *imagecustomizerapi.Config) error {
var err error
logger.Log.Infof("Creating image customizer history file")

// Deep copy the config to avoid modifying the original config
configCopy, err := deepCopyConfig(config)
if err != nil {
return fmt.Errorf("failed to deep copy config while writing image history: %w", err)
}

err = modifyConfig(configCopy, baseConfigPath)
if err != nil {
return fmt.Errorf("failed to modify config while writing image history: %w", err)
}

var allImageHistory []ImageHistory

customizerLoggingDirPath := filepath.Join(imageChroot.RootDir(), "/usr/share/image-customizer")
err = os.MkdirAll(customizerLoggingDirPath, 0755)
if err != nil {
return fmt.Errorf("failed to create customizer logging directory: %w", err)
}

imageHistoryFilePath := filepath.Join(customizerLoggingDirPath, "history.json")

var allImageHistory []ImageHistory
err = readImageHistory(imageHistoryFilePath, &allImageHistory)
if err != nil {
return fmt.Errorf("failed to read image history: %w", err)
Expand Down

0 comments on commit 8d45b60

Please sign in to comment.