Fix vet issues with alicloud

This commit is contained in:
Andrew Garrett 2017-06-07 19:38:26 +00:00 committed by Brett Kochendorfer
parent be2e915b84
commit fbacf883b4
1 changed files with 7 additions and 5 deletions

View File

@ -232,17 +232,18 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
getEndPonit(p.config.OSSBucket), p.config.OSSKey, err)
}
if _, err := ramClient.AttachPolicyToRole(ram.AttachPolicyToRoleRequest{
ram.PolicyRequest{
PolicyRequest: ram.PolicyRequest{
PolicyName: "AliyunECSImageImportRolePolicy",
PolicyType: "System",
}, "AliyunECSImageImportDefaultRole",
},
RoleName: "AliyunECSImageImportDefaultRole",
}); err != nil {
return nil, false, fmt.Errorf("Failed to start import from %s/%s: %s",
getEndPonit(p.config.OSSBucket), p.config.OSSKey, err)
}
} else {
policyListResponse, err := ramClient.ListPoliciesForRole(ram.RoleQueryRequest{
"AliyunECSImageImportDefaultRole",
RoleName: "AliyunECSImageImportDefaultRole",
})
if err != nil {
return nil, false, fmt.Errorf("Failed to start import from %s/%s: %s",
@ -258,10 +259,11 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
}
if isAliyunECSImageImportRolePolicyNotExit {
if _, err := ramClient.AttachPolicyToRole(ram.AttachPolicyToRoleRequest{
ram.PolicyRequest{
PolicyRequest: ram.PolicyRequest{
PolicyName: "AliyunECSImageImportRolePolicy",
PolicyType: "System",
}, "AliyunECSImageImportDefaultRole",
},
RoleName: "AliyunECSImageImportDefaultRole",
}); err != nil {
return nil, false, fmt.Errorf("Failed to start import from %s/%s: %s",
getEndPonit(p.config.OSSBucket), p.config.OSSKey, err)