github.com/Cloud-Foundations/Dominator@v0.3.4/lib/mdb/updateFrom.go (about)

     1  package mdb
     2  
     3  func (dest *Machine) updateFrom(source Machine) {
     4  	if dest.Hostname != source.Hostname {
     5  		return
     6  	}
     7  	if source.IpAddress != "" {
     8  		dest.IpAddress = source.IpAddress
     9  	}
    10  	if source.Location != "" {
    11  		dest.Location = source.Location
    12  	}
    13  	if source.RequiredImage != "" {
    14  		dest.RequiredImage = source.RequiredImage
    15  		dest.DisableUpdates = source.DisableUpdates
    16  	}
    17  	if source.PlannedImage != "" {
    18  		dest.PlannedImage = source.PlannedImage
    19  	}
    20  	if source.OwnerGroup != "" {
    21  		dest.OwnerGroup = source.OwnerGroup
    22  	}
    23  	if source.OwnerGroups != nil {
    24  		dest.OwnerGroups = source.OwnerGroups
    25  	}
    26  	if source.OwnerUsers != nil {
    27  		dest.OwnerUsers = source.OwnerUsers
    28  	}
    29  	if source.Tags != nil {
    30  		dest.Tags = source.Tags
    31  	}
    32  	if source.AwsMetadata != nil {
    33  		if dest.AwsMetadata == nil {
    34  			dest.AwsMetadata = source.AwsMetadata
    35  		} else if !compareAwsMetadata(dest.AwsMetadata, source.AwsMetadata) {
    36  			dest.AwsMetadata = source.AwsMetadata
    37  		}
    38  	}
    39  }