{"action":"created","comment":{"url":"https://api.github.com/repos/Tencent/bk-cmdb/pulls/comments/221454480","pull_request_review_id":160109762,"id":221454480,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTQ1NDQ4MA==","diff_hunk":"@@ -0,0 +1,79 @@\n+/*\n+ * Tencent is pleased to support the open source community by making 蓝鲸 available.\n+ * Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.\n+ * Licensed under the MIT License (the \"License\"); you may not use this file except\n+ * in compliance with the License. You may obtain a copy of the License at\n+ * http://opensource.org/licenses/MIT\n+ * Unless required by applicable law or agreed to in writing, software distributed under\n+ * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n+ * either express or implied. See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package x18_09_30_01\n+\n+import (\n+\t\"fmt\"\n+\t\"time\"\n+\n+\t\"configcenter/src/common\"\n+\t\"configcenter/src/common/blog\"\n+\t\"configcenter/src/common/mapstr\"\n+\t\"configcenter/src/scene_server/admin_server/upgrader\"\n+\t\"configcenter/src/storage\"\n+)\n+\n+func cleanBKCloud(db storage.DI, conf *upgrader.Config) (err error) {\n+\n+\tclouds := []map[string]interface{}{}\n+\n+\terr = db.GetMutilByCondition(common.BKTableNameBasePlat, nil, mapstr.MapStr{}, &clouds, \"create_time\", 0, 0)\n+\tif nil != err && !db.IsNotFoundErr(err) {\n+\t\treturn err\n+\t}\n+\n+\tflag := \"updateflag\"\n+\texistDefault := false\n+\texpects := map[string]map[string]interface{}{}\n+\tfor _, cloud := range clouds {\n+\t\tif cloud[common.BKCloudNameField] == common.DefaultCloudName {\n+\t\t\tcloud[common.BKCloudIDField] = 0\n+\t\t\texistDefault = true\n+\t\t}\n+\t\tcloud[flag] = true\n+\t\texpects[fmt.Sprintf(\"%v:%v\", cloud[common.BKOwnerIDField], cloud[common.BKCloudNameField])] = cloud\n+\t}\n+\n+\tif !existDefault {\n+\t\texpects[\"0:\"+common.DefaultCloudName] = map[string]interface{}{\n+\t\t\tcommon.BKCloudNameField: common.DefaultCloudName,\n+\t\t\tcommon.BKOwnerIDField:   common.BKDefaultOwnerID,\n+\t\t\tcommon.BKCloudIDField:   common.BKDefaultDirSubArea,\n+\t\t\tcommon.CreateTimeField:  time.Now(),\n+\t\t\tcommon.LastTimeField:    time.Now(),\n+\t\t\tflag:                    true,\n+\t\t}\n+\t}\n+\n+\tblog.Info(\"[cleanBKCloud] expects: %+v\", expects)\n+\n+\tfor _, expect := range expects {\n+\t\tif _, err = db.Insert(common.BKTableNameBasePlat, expect); err != nil {\n+\t\t\treturn err\n+\t\t}\n+\t}\n+\n+\tif err = db.DelByCondition(common.BKTableNameBasePlat, map[string]interface{}{\n+\t\tflag: map[string]interface{}{\n+\t\t\t\"$ne\": true,","path":"src/scene_server/admin_server/upgrader/x18.09.30.01/upgrader.go","position":68,"original_position":68,"commit_id":"1d0040760b4afa32be8441cc908ce081953b4c36","original_commit_id":"1d0040760b4afa32be8441cc908ce081953b4c36","user":{"login":"uriwang","id":699316,"node_id":"MDQ6VXNlcjY5OTMxNg==","avatar_url":"https://avatars0.githubusercontent.com/u/699316?v=4","gravatar_id":"","url":"https://api.github.com/users/uriwang","html_url":"https://github.com/uriwang","followers_url":"https://api.github.com/users/uriwang/followers","following_url":"https://api.github.com/users/uriwang/following{/other_user}","gists_url":"https://api.github.com/users/uriwang/gists{/gist_id}","starred_url":"https://api.github.com/users/uriwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uriwang/subscriptions","organizations_url":"https://api.github.com/users/uriwang/orgs","repos_url":"https://api.github.com/users/uriwang/repos","events_url":"https://api.github.com/users/uriwang/events{/privacy}","received_events_url":"https://api.github.com/users/uriwang/received_events","type":"User","site_admin":false},"body":"$ne 用我们定义好的常量替代","created_at":"2018-09-30T10:11:41Z","updated_at":"2018-09-30T10:11:48Z","html_url":"https://github.com/Tencent/bk-cmdb/pull/1155#discussion_r221454480","pull_request_url":"https://api.github.com/repos/Tencent/bk-cmdb/pulls/1155","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Tencent/bk-cmdb/pulls/comments/221454480"},"html":{"href":"https://github.com/Tencent/bk-cmdb/pull/1155#discussion_r221454480"},"pull_request":{"href":"https://api.github.com/repos/Tencent/bk-cmdb/pulls/1155"}}},"pull_request":{"url":"https://api.github.com/repos/Tencent/bk-cmdb/pulls/1155","id":219196595,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5MTk2NTk1","html_url":"https://github.com/Tencent/bk-cmdb/pull/1155","diff_url":"https://github.com/Tencent/bk-cmdb/pull/1155.diff","patch_url":"https://github.com/Tencent/bk-cmdb/pull/1155.patch","issue_url":"https://api.github.com/repos/Tencent/bk-cmdb/issues/1155","number":1155,"state":"open","locked":false,"title":"解决重复的直连区域问题","user":{"login":"wusendong","id":9442975,"node_id":"MDQ6VXNlcjk0NDI5NzU=","avatar_url":"https://avatars2.githubusercontent.com/u/9442975?v=4","gravatar_id":"","url":"https://api.github.com/users/wusendong","html_url":"https://github.com/wusendong","followers_url":"https://api.github.com/users/wusendong/followers","following_url":"https://api.github.com/users/wusendong/following{/other_user}","gists_url":"https://api.github.com/users/wusendong/gists{/gist_id}","starred_url":"https://api.github.com/users/wusendong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wusendong/subscriptions","organizations_url":"https://api.github.com/users/wusendong/orgs","repos_url":"https://api.github.com/users/wusendong/repos","events_url":"https://api.github.com/users/wusendong/events{/privacy}","received_events_url":"https://api.github.com/users/wusendong/received_events","type":"User","site_admin":false},"body":"### 修复的问题：\r\n- 解决重复的直连区域问题\r\n","created_at":"2018-09-30T09:55:53Z","updated_at":"2018-09-30T10:11:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"79ff50b73fc6ad3e70070e6a438b51acd130f398","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Tencent/bk-cmdb/pulls/1155/commits","review_comments_url":"https://api.github.com/repos/Tencent/bk-cmdb/pulls/1155/comments","review_comment_url":"https://api.github.com/repos/Tencent/bk-cmdb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Tencent/bk-cmdb/issues/1155/comments","statuses_url":"https://api.github.com/repos/Tencent/bk-cmdb/statuses/1d0040760b4afa32be8441cc908ce081953b4c36","head":{"label":"wusendong:fixbug","ref":"fixbug","sha":"1d0040760b4afa32be8441cc908ce081953b4c36","user":{"login":"wusendong","id":9442975,"node_id":"MDQ6VXNlcjk0NDI5NzU=","avatar_url":"https://avatars2.githubusercontent.com/u/9442975?v=4","gravatar_id":"","url":"https://api.github.com/users/wusendong","html_url":"https://github.com/wusendong","followers_url":"https://api.github.com/users/wusendong/followers","following_url":"https://api.github.com/users/wusendong/following{/other_user}","gists_url":"https://api.github.com/users/wusendong/gists{/gist_id}","starred_url":"https://api.github.com/users/wusendong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wusendong/subscriptions","organizations_url":"https://api.github.com/users/wusendong/orgs","repos_url":"https://api.github.com/users/wusendong/repos","events_url":"https://api.github.com/users/wusendong/events{/privacy}","received_events_url":"https://api.github.com/users/wusendong/received_events","type":"User","site_admin":false},"repo":{"id":127694924,"node_id":"MDEwOlJlcG9zaXRvcnkxMjc2OTQ5MjQ=","name":"bk-cmdb","full_name":"wusendong/bk-cmdb","private":false,"owner":{"login":"wusendong","id":9442975,"node_id":"MDQ6VXNlcjk0NDI5NzU=","avatar_url":"https://avatars2.githubusercontent.com/u/9442975?v=4","gravatar_id":"","url":"https://api.github.com/users/wusendong","html_url":"https://github.com/wusendong","followers_url":"https://api.github.com/users/wusendong/followers","following_url":"https://api.github.com/users/wusendong/following{/other_user}","gists_url":"https://api.github.com/users/wusendong/gists{/gist_id}","starred_url":"https://api.github.com/users/wusendong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wusendong/subscriptions","organizations_url":"https://api.github.com/users/wusendong/orgs","repos_url":"https://api.github.com/users/wusendong/repos","events_url":"https://api.github.com/users/wusendong/events{/privacy}","received_events_url":"https://api.github.com/users/wusendong/received_events","type":"User","site_admin":false},"html_url":"https://github.com/wusendong/bk-cmdb","description":"蓝鲸智云配置平台(blueking cmdb)","fork":true,"url":"https://api.github.com/repos/wusendong/bk-cmdb","forks_url":"https://api.github.com/repos/wusendong/bk-cmdb/forks","keys_url":"https://api.github.com/repos/wusendong/bk-cmdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wusendong/bk-cmdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wusendong/bk-cmdb/teams","hooks_url":"https://api.github.com/repos/wusendong/bk-cmdb/hooks","issue_events_url":"https://api.github.com/repos/wusendong/bk-cmdb/issues/events{/number}","events_url":"https://api.github.com/repos/wusendong/bk-cmdb/events","assignees_url":"https://api.github.com/repos/wusendong/bk-cmdb/assignees{/user}","branches_url":"https://api.github.com/repos/wusendong/bk-cmdb/branches{/branch}","tags_url":"https://api.github.com/repos/wusendong/bk-cmdb/tags","blobs_url":"https://api.github.com/repos/wusendong/bk-cmdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wusendong/bk-cmdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wusendong/bk-cmdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/wusendong/bk-cmdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wusendong/bk-cmdb/statuses/{sha}","languages_url":"https://api.github.com/repos/wusendong/bk-cmdb/languages","stargazers_url":"https://api.github.com/repos/wusendong/bk-cmdb/stargazers","contributors_url":"https://api.github.com/repos/wusendong/bk-cmdb/contributors","subscribers_url":"https://api.github.com/repos/wusendong/bk-cmdb/subscribers","subscription_url":"https://api.github.com/repos/wusendong/bk-cmdb/subscription","commits_url":"https://api.github.com/repos/wusendong/bk-cmdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/wusendong/bk-cmdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/wusendong/bk-cmdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/wusendong/bk-cmdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/wusendong/bk-cmdb/contents/{+path}","compare_url":"https://api.github.com/repos/wusendong/bk-cmdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wusendong/bk-cmdb/merges","archive_url":"https://api.github.com/repos/wusendong/bk-cmdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wusendong/bk-cmdb/downloads","issues_url":"https://api.github.com/repos/wusendong/bk-cmdb/issues{/number}","pulls_url":"https://api.github.com/repos/wusendong/bk-cmdb/pulls{/number}","milestones_url":"https://api.github.com/repos/wusendong/bk-cmdb/milestones{/number}","notifications_url":"https://api.github.com/repos/wusendong/bk-cmdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wusendong/bk-cmdb/labels{/name}","releases_url":"https://api.github.com/repos/wusendong/bk-cmdb/releases{/id}","deployments_url":"https://api.github.com/repos/wusendong/bk-cmdb/deployments","created_at":"2018-04-02T02:56:12Z","updated_at":"2018-07-25T08:47:40Z","pushed_at":"2018-09-30T10:05:45Z","git_url":"git://github.com/wusendong/bk-cmdb.git","ssh_url":"git@github.com:wusendong/bk-cmdb.git","clone_url":"https://github.com/wusendong/bk-cmdb.git","svn_url":"https://github.com/wusendong/bk-cmdb","homepage":"http://bk.tencent.com","size":43325,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Tencent:master","ref":"master","sha":"4fce52a31334f6c2ce289b8c267b25d469024f1e","user":{"login":"Tencent","id":18461506,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4NDYxNTA2","avatar_url":"https://avatars3.githubusercontent.com/u/18461506?v=4","gravatar_id":"","url":"https://api.github.com/users/Tencent","html_url":"https://github.com/Tencent","followers_url":"https://api.github.com/users/Tencent/followers","following_url":"https://api.github.com/users/Tencent/following{/other_user}","gists_url":"https://api.github.com/users/Tencent/gists{/gist_id}","starred_url":"https://api.github.com/users/Tencent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tencent/subscriptions","organizations_url":"https://api.github.com/users/Tencent/orgs","repos_url":"https://api.github.com/users/Tencent/repos","events_url":"https://api.github.com/users/Tencent/events{/privacy}","received_events_url":"https://api.github.com/users/Tencent/received_events","type":"Organization","site_admin":false},"repo":{"id":76221943,"node_id":"MDEwOlJlcG9zaXRvcnk3NjIyMTk0Mw==","name":"bk-cmdb","full_name":"Tencent/bk-cmdb","private":false,"owner":{"login":"Tencent","id":18461506,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4NDYxNTA2","avatar_url":"https://avatars3.githubusercontent.com/u/18461506?v=4","gravatar_id":"","url":"https://api.github.com/users/Tencent","html_url":"https://github.com/Tencent","followers_url":"https://api.github.com/users/Tencent/followers","following_url":"https://api.github.com/users/Tencent/following{/other_user}","gists_url":"https://api.github.com/users/Tencent/gists{/gist_id}","starred_url":"https://api.github.com/users/Tencent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tencent/subscriptions","organizations_url":"https://api.github.com/users/Tencent/orgs","repos_url":"https://api.github.com/users/Tencent/repos","events_url":"https://api.github.com/users/Tencent/events{/privacy}","received_events_url":"https://api.github.com/users/Tencent/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Tencent/bk-cmdb","description":"蓝鲸智云配置平台(blueking cmdb)","fork":false,"url":"https://api.github.com/repos/Tencent/bk-cmdb","forks_url":"https://api.github.com/repos/Tencent/bk-cmdb/forks","keys_url":"https://api.github.com/repos/Tencent/bk-cmdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Tencent/bk-cmdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Tencent/bk-cmdb/teams","hooks_url":"https://api.github.com/repos/Tencent/bk-cmdb/hooks","issue_events_url":"https://api.github.com/repos/Tencent/bk-cmdb/issues/events{/number}","events_url":"https://api.github.com/repos/Tencent/bk-cmdb/events","assignees_url":"https://api.github.com/repos/Tencent/bk-cmdb/assignees{/user}","branches_url":"https://api.github.com/repos/Tencent/bk-cmdb/branches{/branch}","tags_url":"https://api.github.com/repos/Tencent/bk-cmdb/tags","blobs_url":"https://api.github.com/repos/Tencent/bk-cmdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Tencent/bk-cmdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Tencent/bk-cmdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/Tencent/bk-cmdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Tencent/bk-cmdb/statuses/{sha}","languages_url":"https://api.github.com/repos/Tencent/bk-cmdb/languages","stargazers_url":"https://api.github.com/repos/Tencent/bk-cmdb/stargazers","contributors_url":"https://api.github.com/repos/Tencent/bk-cmdb/contributors","subscribers_url":"https://api.github.com/repos/Tencent/bk-cmdb/subscribers","subscription_url":"https://api.github.com/repos/Tencent/bk-cmdb/subscription","commits_url":"https://api.github.com/repos/Tencent/bk-cmdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/Tencent/bk-cmdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/Tencent/bk-cmdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/Tencent/bk-cmdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/Tencent/bk-cmdb/contents/{+path}","compare_url":"https://api.github.com/repos/Tencent/bk-cmdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Tencent/bk-cmdb/merges","archive_url":"https://api.github.com/repos/Tencent/bk-cmdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Tencent/bk-cmdb/downloads","issues_url":"https://api.github.com/repos/Tencent/bk-cmdb/issues{/number}","pulls_url":"https://api.github.com/repos/Tencent/bk-cmdb/pulls{/number}","milestones_url":"https://api.github.com/repos/Tencent/bk-cmdb/milestones{/number}","notifications_url":"https://api.github.com/repos/Tencent/bk-cmdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Tencent/bk-cmdb/labels{/name}","releases_url":"https://api.github.com/repos/Tencent/bk-cmdb/releases{/id}","deployments_url":"https://api.github.com/repos/Tencent/bk-cmdb/deployments","created_at":"2016-12-12T04:29:08Z","updated_at":"2018-09-30T09:14:31Z","pushed_at":"2018-09-30T10:07:13Z","git_url":"git://github.com/Tencent/bk-cmdb.git","ssh_url":"git@github.com:Tencent/bk-cmdb.git","clone_url":"https://github.com/Tencent/bk-cmdb.git","svn_url":"https://github.com/Tencent/bk-cmdb","homepage":"http://bk.tencent.com","size":43829,"stargazers_count":1600,"watchers_count":1600,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":595,"mirror_url":null,"archived":false,"open_issues_count":56,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":595,"open_issues":56,"watchers":1600,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Tencent/bk-cmdb/pulls/1155"},"html":{"href":"https://github.com/Tencent/bk-cmdb/pull/1155"},"issue":{"href":"https://api.github.com/repos/Tencent/bk-cmdb/issues/1155"},"comments":{"href":"https://api.github.com/repos/Tencent/bk-cmdb/issues/1155/comments"},"review_comments":{"href":"https://api.github.com/repos/Tencent/bk-cmdb/pulls/1155/comments"},"review_comment":{"href":"https://api.github.com/repos/Tencent/bk-cmdb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Tencent/bk-cmdb/pulls/1155/commits"},"statuses":{"href":"https://api.github.com/repos/Tencent/bk-cmdb/statuses/1d0040760b4afa32be8441cc908ce081953b4c36"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"uriwang"}}