728x90

현재 기여하고있는 명령어 사용법

 

 


 

코드 기여 내용 

 

 

_proxy 에 추가한 pool

멘토님께 여쭤본 결과, proxy 를 우선적으로 구현해야 함을 깨달았다. _proxy.py 를 살펴보면, 비슷한 구조의 다른 api 를 확인할 수 있다. 그 예시로, zone export 의 get 같은 경우에도 내가 맡은 api 인 pool show 의 GET API 와 비슷하기 때문에 그 코드의 prxoy 와 리소스를 참고하여 진행했다.

 # ======== Pools ========
    def pools(self, **query):
        """Retrieve a generator of pools

        :param dict query: Optional query parameters to be sent to limit the
            resources being returned.

        :returns: A generator of pool
            :class:`~openstack.dns.v2.pool.Pool` instances.
        """
        return self._list(_pool.Pool, **query)

    def get_pool(self, pool):
        """Get a pool

        :param pool: The value can be the ID of a pool
            or a :class:`~openstack.dns.v2.pool.Pool` instance.
        :returns: Pool instance.
        :rtype: :class:`~openstack.dns.v2.pool.Pool`
        """
        return self._get(_pool.Pool, pool)

 

pool리소스 코드

from openstack.dns.v2 import _base
from openstack import exceptions
from openstack import resource
from openstack import utils


class Pool(_base.Resource):
    """DNS Pool Resource"""

    resources_key = 'pools'
    base_path = '/pools'

    # capabilities
    allow_list = True

    commit_method = "GET"

    #: Properties
    # Description for the resource.
    description = resource.Body('description')
    # ID for this pool
    id = resource.Body('id')
    # Key:Value pairs of information about this pool
    attributes = resource.Body('attributes', type=dict)
    # ID for the project that owns the resource
    project_id = resource.Body('project_id')
    #
    # Name Servers for this pool. Any zones hosted by this pool should be delegated to these DNS servers
    ns_records = resource.Body('ns_records', type=list)
    # Name for this pool
    name = resource.Body('name')
    # Timestamp when the pool was created
    created_at = resource.Body('created_at')
    # Timestamp when the pool was last updated
    updated_at = resource.Body('updated_at')
    # Links to the resource, and other related resources.
    links = resource.Body('links', type=dict)

 

test pool

from unittest import mock
from keystoneauth1 import adapter
from openstack.dns.v2 import pool
from openstack.tests.unit import base

IDENTIFIER = 'NAME'
EXAMPLE = {
    "description": 'null',
    "id": IDENTIFIER,
    "project_id": "noauth-project",
    "created_at": "2015-02-23T21:56:33.000000",
    "attributes": 'null',
    "ns_records": [{"hostname": "ns2.example.org.", "priority": 1}],
    "links": {
        "self": "http://127.0.0.1:9001/v2/pools/d1716333-8c16-490f-85ee-29af36907605"
    },
    "name": "example_pool",
    "updated_at": 'null',
}


class TestPool(base.TestCase):
    def test_basic(self):
        sot = pool.Pool()
        self.assertEqual(None, sot.resource_key)
        self.assertEqual('pools', sot.resources_key)
        self.assertEqual('/pools', sot.base_path)
        self.assertTrue(sot.allow_list)

        self.assertEqual('GET', sot.commit_method)

 

리뷰를 올려봤다.

 

 

https://review.opendev.org/c/openstack/openstacksdk/+/927683

 

https://review.opendev.org/c/openstack/openstacksdk/+/927683

 

review.opendev.org

 

 

 

지금 발생한 zuul 테스트 실패 오류 : pep 오류 란다

파이썬 코드 컨벤션이 안맞다고 한다.

 

그래서 tox -e pep8 명령을 이용해 컨벤션을 맞춰줬다. (일전에 이미 컨벤션 관련 파일 black 을 import 해둠 )

기여 과정에서 겪은 시행착오 및 해결방법 

더보기

에러 로그 

openstack/cloud/exc.py:29:1: O310: Use of deprecated Exception class
class OpenStackCloudCreateException(OpenStackCloudException):
^
openstack/cloud/exc.py:41:1: O310: Use of deprecated Exception class
OpenStackCloudTimeout = exceptions.ResourceTimeout
^
openstack/cloud/exc.py:42:1: O310: Use of deprecated Exception class
OpenStackCloudHTTPError = exceptions.HttpException
^
openstack/cloud/exc.py:43:1: O310: Use of deprecated Exception class
OpenStackCloudBadRequest = exceptions.BadRequestException
^
openstack/cloud/exc.py:44:1: O310: Use of deprecated Exception class
OpenStackCloudURINotFound = exceptions.NotFoundException
^
openstack/cloud/exc.py:45:1: O310: Use of deprecated Exception class
OpenStackCloudResourceNotFound = OpenStackCloudURINotFound
^
openstack/cloud/exc.py:45:1: O310: Use of deprecated Exception class
OpenStackCloudResourceNotFound = OpenStackCloudURINotFound
^
openstack/dns/v2/_proxy.py:20:1: H306: imports not in alphabetical order (openstack.dns.v2.zone_transfer, openstack.dns.v2.pool)
from openstack.dns.v2 import pool as _pool
^
openstack/dns/v2/_proxy.py:22:1: I202 Additional newline in a group of imports. 'from openstac
k import proxy' is identified as Application and 'from openstack.dns.v2 import pool' is identified as Application.
from openstack import proxy
^
openstack/dns/v2/pool.py:1:1: H102: Apache 2.0 license header not found
from openstack.dns.v2 import _base
^
openstack/dns/v2/pool.py:2:1: F401 'openstack.exceptions' imported but unused
from openstack import exceptions
^
openstack/dns/v2/pool.py:4:1: F401 'openstack.utils' imported but unused
from openstack import utils
^
openstack/tests/unit/dns/v2/test_pool.py:1:1: F401 'unittest.mock' imported but unused        
from unittest import mock
^
openstack/tests/unit/dns/v2/test_pool.py:1:1: H102: Apache 2.0 license header not found       
from unittest import mock
^
openstack/tests/unit/dns/v2/test_pool.py:2:1: I201 Missing newline between import groups. 'fro
m keystoneauth1 import adapter' is identified as Third Party and 'from unittest import mock' is identified as Stdlib.
from keystoneauth1 import adapter
^
openstack/tests/unit/dns/v2/test_pool.py:2:1: F401 'keystoneauth1.adapter' imported but unused
from keystoneauth1 import adapter
^
openstack/tests/unit/dns/v2/test_pool.py:2:1: H306: imports not in alphabetical order (unittest.mock, keystoneauth1.adapter)
from keystoneauth1 import adapter
^
openstack/tests/unit/dns/v2/test_pool.py:3:1: I201 Missing newline between import groups. 'fro
m openstack.dns.v2 import pool' is identified as Application and 'from keystoneauth1 import adapter' is identified as Third Party.
from openstack.dns.v2 import pool
^

mypy.....................................................................Passed
pre-commit hook(s) made changes.
If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.   
To run `pre-commit` as part of git workflow, use `pre-commit install`.
All changes made by hooks:

diff --git a/MANIFEST.in b/MANIFEST.in
index 90f8a7aef..c978a52da 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -3,4 +3,4 @@ include ChangeLog
 exclude .gitignore
 exclude .gitreview

-global-exclude *.pyc
\ No newline at end of file
+global-exclude *.pyc
diff --git a/openstack/config/vendors/ovh.json b/openstack/config/vendors/ovh.json
index f65f9c67f..4a5d38309 100644
--- a/openstack/config/vendors/ovh.json
+++ b/openstack/config/vendors/ovh.json
@@ -3,4 +3,4 @@
   "profile": {
     "profile": "https://ovhcloud.com"
   }
-}
\ No newline at end of file
+}
diff --git a/openstack/tests/unit/dns/v2/test_pool.py b/openstack/tests/unit/dns/v2/test_pool.py
index c1968c5fe..b5ffc1c5f 100644
--- a/openstack/tests/unit/dns/v2/test_pool.py
+++ b/openstack/tests/unit/dns/v2/test_pool.py
@@ -5,26 +5,20 @@ from openstack.tests.unit import base

 IDENTIFIER = 'NAME'
 EXAMPLE = {
-
-  "description": 'null',
-  "id": IDENTIFIER,
-  "project_id": "noauth-project",
-  "created_at": "2015-02-23T21:56:33.000000",
-  "attributes": 'null',
-  "ns_records": [
-    {
-      "hostname": "ns2.example.org.",
-      "priority": 1
-    }
-  ],
-  "links": {
-    "self": "http://127.0.0.1:9001/v2/pools/d1716333-8c16-490f-85ee-29af36907605"
-  },
-  "name": "example_pool",
-  "updated_at": 'null',
-
+    "description": 'null',
+    "id": IDENTIFIER,
+    "project_id": "noauth-project",
+    "created_at": "2015-02-23T21:56:33.000000",
+    "attributes": 'null',
+    "ns_records": [{"hostname": "ns2.example.org.", "priority": 1}],
+    "links": {
+        "self": "http://127.0.0.1:9001/v2/pools/d1716333-8c16-490f-85ee-29af36907605"        
+    },
+    "name": "example_pool",
+    "updated_at": 'null',
 }

+
 class TestPool(base.TestCase):
     def test_basic(self):
         sot = pool.Pool()
@@ -34,4 +28,3 @@ class TestPool(base.TestCase):
         self.assertTrue(sot.allow_list)

         self.assertEqual('GET', sot.commit_method)
-
diff --git a/openstack/tests/unit/fixtures/shared-file-system.json b/openstack/tests/unit/fixtures/shared-file-system.json
index 3d22f6e5c..14257f760 100644
--- a/openstack/tests/unit/fixtures/shared-file-system.json
+++ b/openstack/tests/unit/fixtures/shared-file-system.json
@@ -25,4 +25,4 @@
       ]
     }
   ]
-}
\ No newline at end of file
+}
diff --git a/releasenotes/notes/add-image-metadef-schema-b463825481bdf954.yaml b/releasenotes/notes/add-image-metadef-schema-b463825481bdf954.yaml
index f02975932..743f79cd6 100644
--- a/releasenotes/notes/add-image-metadef-schema-b463825481bdf954.yaml
+++ b/releasenotes/notes/add-image-metadef-schema-b463825481bdf954.yaml
@@ -1,3 +1,3 @@
 ---
 features:
-  - Add support for metadata definition schema resource in image service.
\ No newline at end of file
+  - Add support for metadata definition schema resource in image service.
diff --git a/releasenotes/notes/add-node-inventory-52f54e16777814e7.yaml b/releasenotes/notes/add-node-inventory-52f54e16777814e7.yaml
index 5e4b84128..806f56873 100644
--- a/releasenotes/notes/add-node-inventory-52f54e16777814e7.yaml
+++ b/releasenotes/notes/add-node-inventory-52f54e16777814e7.yaml
@@ -2,4 +2,4 @@
 features:
   - |
     Adds support for querying a node's hardware inventory as per functionality
-    introduced in API 1.81.
\ No newline at end of file
+    introduced in API 1.81.
diff --git a/releasenotes/notes/add-shared-file-system-manage-unmanage-share-830e313f96e5fd2b.yaml b/releasenotes/notes/add-shared-file-system-manage-unmanage-share-830e313f96e5fd2b.yaml  
index d349d6c90..9c34195e9 100644
--- a/releasenotes/notes/add-shared-file-system-manage-unmanage-share-830e313f96e5fd2b.yaml   
+++ b/releasenotes/notes/add-shared-file-system-manage-unmanage-share-830e313f96e5fd2b.yaml   
@@ -2,4 +2,4 @@
 features:
   - |
     Added support to manage and unmanage shares
-    from the shared file system service.
\ No newline at end of file
+    from the shared file system service.
diff --git a/releasenotes/notes/add-shared-file-system-share-metadata-e0415bb71d8a0a48.yaml b/releasenotes/notes/add-shared-file-system-share-metadata-e0415bb71d8a0a48.yaml
index 6461ec7b7..6019f5eeb 100644
--- a/releasenotes/notes/add-shared-file-system-share-metadata-e0415bb71d8a0a48.yaml
+++ b/releasenotes/notes/add-shared-file-system-share-metadata-e0415bb71d8a0a48.yaml
@@ -3,4 +3,4 @@ features:
   - |
     Added support to list, get, create,
     update, and delete share metadata
-    from shared file system service.
\ No newline at end of file
+    from shared file system service.
diff --git a/releasenotes/notes/add-stack-events-b8674d7bb657e789.yaml b/releasenotes/notes/add-stack-events-b8674d7bb657e789.yaml
index cdc9367f0..a0fd35a21 100644
--- a/releasenotes/notes/add-stack-events-b8674d7bb657e789.yaml
+++ b/releasenotes/notes/add-stack-events-b8674d7bb657e789.yaml
@@ -2,4 +2,4 @@
 features:
   - |
     The ``stack_events`` method and ``StackEvent`` Class have been
-    added to retrieve stack events
\ No newline at end of file
+    added to retrieve stack events
diff --git a/releasenotes/notes/add-stack-suspend-and-resume-26d4fc5904291d5d.yaml b/releasenotes/notes/add-stack-suspend-and-resume-26d4fc5904291d5d.yaml
index fa3eecd46..2cad756d4 100644
--- a/releasenotes/notes/add-stack-suspend-and-resume-26d4fc5904291d5d.yaml
+++ b/releasenotes/notes/add-stack-suspend-and-resume-26d4fc5904291d5d.yaml
@@ -1,4 +1,4 @@
 ---
 features:
   - |
-    Adds ``suspend_stack`` and ``resume_stack`` to support stack non-lifecycle operations.   
\ No newline at end of file
+    Adds ``suspend_stack`` and ``resume_stack`` to support stack non-lifecycle operations.   
diff --git a/releasenotes/notes/add-support-availability_zone-loadbalancer-a18aa1708d7859e2.yaml b/releasenotes/notes/add-support-availability_zone-loadbalancer-a18aa1708d7859e2.yaml      
index 0a0efef26..4cb480a32 100644
--- a/releasenotes/notes/add-support-availability_zone-loadbalancer-a18aa1708d7859e2.yaml     
+++ b/releasenotes/notes/add-support-availability_zone-loadbalancer-a18aa1708d7859e2.yaml     
@@ -1,3 +1,3 @@
 ---
 features:
-  - Added availability_zone parameter into load balancer.
\ No newline at end of file
+  - Added availability_zone parameter into load balancer.
diff --git a/releasenotes/notes/baremetal-retired-fields-f56a4632ad4797d7.yaml b/releasenotes/notes/baremetal-retired-fields-f56a4632ad4797d7.yaml
index 115febd22..e21edf07b 100644
--- a/releasenotes/notes/baremetal-retired-fields-f56a4632ad4797d7.yaml
+++ b/releasenotes/notes/baremetal-retired-fields-f56a4632ad4797d7.yaml
@@ -1,4 +1,4 @@
 ---
 features:
   - |
-    Adds ``is_retired`` and ``retired_reason`` to the baremetal Node schema.
\ No newline at end of file
+    Adds ``is_retired`` and ``retired_reason`` to the baremetal Node schema.
diff --git a/releasenotes/notes/block-storage-init-return-95b465b4755f03ca.yaml b/releasenotes/notes/block-storage-init-return-95b465b4755f03ca.yaml
index 6650ac89a..aa99da486 100644
--- a/releasenotes/notes/block-storage-init-return-95b465b4755f03ca.yaml
+++ b/releasenotes/notes/block-storage-init-return-95b465b4755f03ca.yaml
@@ -4,4 +4,4 @@ features:
     Methods ``openstack.block_storage.v3.volume.Volume.init_attachment`` and
     ``block_storage.init_volume_attachment`` now return the results of the POST
     request instead of None. This replicates the behaviour of cinderclient; the
-    returned data is used by nova and ironic for managing volume attachments.
\ No newline at end of file
+    returned data is used by nova and ironic for managing volume attachments.
diff --git a/releasenotes/notes/compute-quotas-b07a0f24dfac8444.yaml b/releasenotes/notes/compute-quotas-b07a0f24dfac8444.yaml
index 6e170359c..f45ed3856 100644
--- a/releasenotes/notes/compute-quotas-b07a0f24dfac8444.yaml
+++ b/releasenotes/notes/compute-quotas-b07a0f24dfac8444.yaml
@@ -1,3 +1,3 @@
 ---
 features:
-  - Add new APIs, OperatorCloud.get_compute_quotas(), OperatorCloud.set_compute_quotas() and OperatorCloud.delete_compute_quotas() to manage nova quotas for projects and users
\ No newline at end of file
+  - Add new APIs, OperatorCloud.get_compute_quotas(), OperatorCloud.set_compute_quotas() and OperatorCloud.delete_compute_quotas() to manage nova quotas for projects and users
diff --git a/releasenotes/notes/introduce-source-and-destination-ip-prefixes-into-metering-lab
el-rules-e04b797adac5d0d0.yaml b/releasenotes/notes/introduce-source-and-destination-ip-prefixes-into-metering-label-rules-e04b797adac5d0d0.yaml
index 5de538b14..fd4c018b7 100644
--- a/releasenotes/notes/introduce-source-and-destination-ip-prefixes-into-metering-label-rules-e04b797adac5d0d0.yaml
+++ b/releasenotes/notes/introduce-source-and-destination-ip-prefixes-into-metering-label-rules-e04b797adac5d0d0.yaml
@@ -2,4 +2,4 @@
 features:
   - |
     Add ``source_ip_prefix`` and ``destination_ip_prefix`` to Neutron metering
-    label rules.
\ No newline at end of file
+    label rules.
diff --git a/releasenotes/notes/ironic-deploy-template-support-fa56005365ed6e4d.yaml b/releasenotes/notes/ironic-deploy-template-support-fa56005365ed6e4d.yaml
index d8b13ea7a..b002879fa 100644
--- a/releasenotes/notes/ironic-deploy-template-support-fa56005365ed6e4d.yaml
+++ b/releasenotes/notes/ironic-deploy-template-support-fa56005365ed6e4d.yaml
@@ -1,4 +1,4 @@
 ---
 features:
   - |
-    Support Deploy Templates for Ironic API
\ No newline at end of file
+    Support Deploy Templates for Ironic API
diff --git a/releasenotes/notes/network-quotas-b98cce9ffeffdbf4.yaml b/releasenotes/notes/network-quotas-b98cce9ffeffdbf4.yaml
index a58cbeab4..ff9426bae 100644
--- a/releasenotes/notes/network-quotas-b98cce9ffeffdbf4.yaml
+++ b/releasenotes/notes/network-quotas-b98cce9ffeffdbf4.yaml
@@ -1,3 +1,3 @@
 ---
 features:
-  - Add new APIs, OperatorCloud.get_network_quotas(), OperatorCloud.set_network_quotas() and OperatorCloud.delete_network_quotas() to manage neutron quotas for projects and users
\ No newline at end of file
+  - Add new APIs, OperatorCloud.get_network_quotas(), OperatorCloud.set_network_quotas() and OperatorCloud.delete_network_quotas() to manage neutron quotas for projects and users
diff --git a/releasenotes/notes/volume-quotas-5b674ee8c1f71eb6.yaml b/releasenotes/notes/volume-quotas-5b674ee8c1f71eb6.yaml
index 2507aacf2..2f367d9dd 100644
--- a/releasenotes/notes/volume-quotas-5b674ee8c1f71eb6.yaml
+++ b/releasenotes/notes/volume-quotas-5b674ee8c1f71eb6.yaml
@@ -1,3 +1,3 @@
 ---
 features:
-  - Add new APIs, OperatorCloud.get_volume_quotas(), OperatorCloud.set_volume_quotas() and OperatorCloud.delete_volume_quotas() to manage cinder quotas for projects and users
\ No newline at end of file
+  - Add new APIs, OperatorCloud.get_volume_quotas(), OperatorCloud.set_volume_quotas() and OperatorCloud.delete_volume_quotas() to manage cinder quotas for projects and users
pep8: exit 1 (591.03 seconds) D:\openstack\contribution-academy\first\openstacksdk2\openstacksdk> pre-commit run --all-files --show-diff-on-failure pid=12996
  pep8: FAIL code 1 (686.98=setup[95.95]+cmd[591.03] seconds)
  evaluation failed :( (688.20 seconds)

 

위 (접은글) 오류는 말그대로 컨벤션오류로 인한 것이다.

알파벳 순서, 아팟치 주석 등을 추가하여 컨벤션을 맞춰주어 해결하였다. 

 

오류 해결 후에 이전에 올린 리뷰를 병합할 때에는 

git add
git commit --amend
git review

요렇게 해두면 알아서 패칭된다. ( 커밋메시지 수정 x )

 

opendev 에서는 zuul 동작을 내 리뷰 id 로 검색해서 확인가능하다. 

 

 

https://zuul.opendev.org/t/openstack/build/e2339a8e68c74e9bbb329b75766f876f

 

Zuul

 

zuul.opendev.org

 

https://zuul.opendev.org/t/openstack/status#927683

 

zuul 이 통과하면 +1 을 확인가능하다.

 

 

( 삽질로 인한 패치셋 무려 8개!ㅎ..) 

 

728x90
리촬리