Merge pull request #4572 from justinsb/fix_roundtrip_rt_igw_dhcp

Update find logic for newly shared objects
This commit is contained in:
k8s-ci-robot 2018-03-04 14:57:50 -08:00 committed by GitHub
commit 75cef70d58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 2 deletions

View File

@ -79,6 +79,7 @@ func (e *DHCPOptions) Find(c *fi.Context) (*DHCPOptions, error) {
actual := &DHCPOptions{
ID: o.DhcpOptionsId,
Name: findNameTag(o.Tags),
Tags: intersectTags(o.Tags, e.Tags),
}
for _, s := range o.DhcpConfigurations {
@ -104,6 +105,7 @@ func (e *DHCPOptions) Find(c *fi.Context) (*DHCPOptions, error) {
// Avoid spurious changes
actual.Lifecycle = e.Lifecycle
actual.Shared = e.Shared
return actual, nil
}

View File

@ -93,6 +93,7 @@ func (e *InternetGateway) Find(c *fi.Context) (*InternetGateway, error) {
actual := &InternetGateway{
ID: igw.InternetGatewayId,
Name: findNameTag(igw.Tags),
Tags: intersectTags(igw.Tags, e.Tags),
}
glog.V(2).Infof("found matching InternetGateway %q", *actual.ID)

View File

@ -89,6 +89,7 @@ func TestSharedInternetGatewayDoesNotRename(t *testing.T) {
VPC: vpc1,
Shared: fi.Bool(true),
ID: internetGateway.InternetGateway.InternetGatewayId,
Tags: make(map[string]string),
}
return map[string]fi.Task{

View File

@ -62,12 +62,14 @@ func (e *RouteTable) Find(c *fi.Context) (*RouteTable, error) {
ID: rt.RouteTableId,
VPC: &VPC{ID: rt.VpcId},
Name: e.Name,
Tags: intersectTags(rt.Tags, e.Tags),
}
glog.V(2).Infof("found matching RouteTable %q", *actual.ID)
e.ID = actual.ID
// Prevent spurious changes
actual.Lifecycle = e.Lifecycle
actual.Shared = e.Shared
return actual, nil
}

View File

@ -215,12 +215,16 @@ func (t *DryRunTarget) PrintReport(taskMap map[string]Task, out io.Writer) error
if err != nil {
return err
}
taskName := getTaskName(r.changes)
fmt.Fprintf(b, " %s/%s\n", taskName, idForTask(taskMap, r.e))
if len(changeList) == 0 {
fmt.Fprintf(b, " internal consistency error!\n")
fmt.Fprintf(b, " actual: %+v\n", r.a)
fmt.Fprintf(b, " expect: %+v\n", r.e)
continue
}
taskName := getTaskName(r.changes)
fmt.Fprintf(b, " %s/%s\n", taskName, idForTask(taskMap, r.e))
for _, change := range changeList {
lines := strings.Split(change.Description, "\n")
if len(lines) == 1 {