mirror of https://github.com/kubernetes/kops.git
Support multiple lifecycle hooks for the same ASG in our mocks
This commit is contained in:
parent
3ace7fd47d
commit
cdea136e64
|
@ -358,7 +358,8 @@ func (m *MockAutoscaling) PutLifecycleHook(input *autoscaling.PutLifecycleHookIn
|
||||||
if m.LifecycleHooks == nil {
|
if m.LifecycleHooks == nil {
|
||||||
m.LifecycleHooks = make(map[string]*autoscaling.LifecycleHook)
|
m.LifecycleHooks = make(map[string]*autoscaling.LifecycleHook)
|
||||||
}
|
}
|
||||||
m.LifecycleHooks[*hook.AutoScalingGroupName] = hook
|
name := *input.AutoScalingGroupName + "::" + *input.LifecycleHookName
|
||||||
|
m.LifecycleHooks[name] = hook
|
||||||
|
|
||||||
return &autoscaling.PutLifecycleHookOutput{}, nil
|
return &autoscaling.PutLifecycleHookOutput{}, nil
|
||||||
}
|
}
|
||||||
|
@ -367,13 +368,14 @@ func (m *MockAutoscaling) DescribeLifecycleHooks(input *autoscaling.DescribeLife
|
||||||
m.mutex.Lock()
|
m.mutex.Lock()
|
||||||
defer m.mutex.Unlock()
|
defer m.mutex.Unlock()
|
||||||
|
|
||||||
name := *input.AutoScalingGroupName
|
|
||||||
response := &autoscaling.DescribeLifecycleHooksOutput{}
|
response := &autoscaling.DescribeLifecycleHooksOutput{}
|
||||||
|
for _, lifecycleHookName := range input.LifecycleHookNames {
|
||||||
|
name := *input.AutoScalingGroupName + "::" + *lifecycleHookName
|
||||||
|
|
||||||
hook := m.LifecycleHooks[name]
|
hook := m.LifecycleHooks[name]
|
||||||
if hook == nil {
|
if hook != nil {
|
||||||
return response, nil
|
response.LifecycleHooks = append(response.LifecycleHooks, hook)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
response.LifecycleHooks = []*autoscaling.LifecycleHook{hook}
|
|
||||||
return response, nil
|
return response, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue