This repository was archived by the owner on Mar 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Grant Orchard
committed
May 11, 2019
1 parent
1349f87
commit 59e6fa8
Showing
1 changed file
with
31 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,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() |