Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/alicloud_pvtz_zone: Support update sync_status without user_info #4372

Merged
merged 1 commit into from
Dec 17, 2021

Conversation

Wanghx0991
Copy link
Contributor

No description provided.

conn, err := client.NewPvtzClient()
if err != nil {
return WrapError(err)
if _, ok := d.GetOk("user_info"); !ok {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

客户提出应该与控制台功能保持一致, 配置同步任务变更, 应该自动更改, 所以需要查询一次

Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"user_id": {
Type: schema.TypeString,
Optional: true,
},
"region_ids": {
Type: schema.TypeList,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

客户做plan的时候发现了diff

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方要打包测试下,看下List 和Set 是否相互兼容,我印象中是兼容的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

兼容的

Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"user_id": {
Type: schema.TypeString,
Optional: true,
},
"region_ids": {
Type: schema.TypeList,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方要打包测试下,看下List 和Set 是否相互兼容,我印象中是兼容的

if IsExpectedErrors(err, []string{"MissingRegion"}) {
log.Printf("[DEBUG] Resource alicloud_private_zone_zone UpdateSyncEcsHostTask Missed Region!!! %s", err)
return nil
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个报错为啥要直接返回 nil 了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这块还是因为之前说的,控制台通过status管理同步任务, 但Api里status,user_info这两个字段都应该是必填项, pvtz的做法是前端查出来自己填进去带给后端,这时会有几个情况:

  1. 用户创建资源未配置同步任务
  2. 用户创建资源没有配置同步任务, 但status置位了关闭状态(此时会有报错, 是预期中的错误)

@xiaozhu36 xiaozhu36 merged commit 1847f1b into aliyun:master Dec 17, 2021
@Wanghx0991 Wanghx0991 deleted the pvtz_zone_added branch December 17, 2021 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants