Skip to content
This repository was archived by the owner on Mar 15, 2021. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Grant Orchard committed May 11, 2019
1 parent 1349f87 commit 59e6fa8
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions examples/get_cluster_ips.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import argparse
import os
from caspyr import Session, Machine


def getargs():
parser = argparse.ArgumentParser()
parser.add_argument('-t', '--token',
required=True,
action='store'
)
parser.add_argument('-n', '--cluster_name',
required=True,
help='The value of the tag assigned to the machine'
)
args = parser.parse_args()
return args


def get_ips(token, cluster_name):
s = Session.login(token)
ips = [Machine.get_ip(s, master['id']) for master in Machine.find_by_tag(s, key=cluster_name, value='master')]
print(ips)


def main():
args = getargs()
get_ips(token=args.token, cluster_name=args.cluster_name)

if __name__ == '__main__':
main()

0 comments on commit 59e6fa8

Please sign in to comment.