-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic implementation of Digital Ocean Metadata.
- Loading branch information
1 parent
364deab
commit 79954d5
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
from .baseapi import BaseAPI | ||
|
||
class Metadata(BaseAPI): | ||
droplet_id = None | ||
end_point = "http://169.254.169.254/metadata/v1" | ||
|
||
def __init__(self, *args, **kwargs): | ||
super(Metadata, self).__init__(*args, **kwargs) | ||
self.end_point = "http://169.254.169.254/metadata/v1" | ||
|
||
def load(self): | ||
metadata = self.get_data(".json") | ||
|
||
for attr in metadata.keys(): | ||
setattr(self,attr,metadata[attr]) | ||
|
||
return self | ||
|
||
def __str__(self): | ||
return "%s" % self.droplet_id |