Last active
January 2, 2016 17:19
-
-
Save KushalP/8335915 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from peewee import * | |
DATABASE = SqliteDatabase("hosts.db") | |
class BaseModel(Model): | |
class Meta: | |
database = DATABASE | |
class Hosts(BaseModel): | |
name = CharField(max_length=256) | |
jump = CharField(max_length=256) | |
jenkins = CharField(max_length=256) | |
nexus = CharField(max_length=256) | |
domain = CharField(max_length=256) | |
role = CharField(max_length=256) | |
env = CharField(max_length=256) | |
cpu = IntegerField() | |
def fqdn(self): | |
return "{n}.{d}".format(n=self.name, d=self.domain) | |
if __name__ == "__main__": | |
DATABASE.connect() | |
for host in Hosts.select().where(Hosts.env == "preview"): | |
print host.fqdn() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment