libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [libcloud] Kami commented on a change in pull request #1282: Packet driver extensions
Date Thu, 04 Jul 2019 21:22:10 GMT
Kami commented on a change in pull request #1282: Packet driver extensions

 File path: libcloud/compute/drivers/
 @@ -88,11 +98,88 @@ class PacketNodeDriver(NodeDriver):
                       'failed': NodeState.ERROR,
                       'active': NodeState.RUNNING}
-    def list_nodes(self, ex_project_id):
-        data = self.connection.request('/projects/%s/devices' %
-                                       (ex_project_id),
-                                       params={'include': 'plan'}
-                                       ).object['devices']
+    def __init__(self, key, project=None):
+        # initialize a NodeDriver for Packet using the API token
+        # and optionally the project (name or id)
+        # If project specified we need to be sure this is a valid project
+        # so we create the variable self.project_id
+        super(PacketNodeDriver, self).__init__(key=key, project=None)
+        self.project_name = project
+        self.project_id = None
+        self.projects = self.ex_list_projects()
 Review comment:
   Can't recall from top of my head.
   Can probably just use @property and internal variable which is set to ``None`` inside the
constructor and inside the property method we call the API if that value is none. Something
along the lines of:
   def projects(self):
       if not self._projects:
           self._projects = self.ex_list_projects()
       return self._projects

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

View raw message