blob: 90dc400e0c88cfb8ffc32e3bad1ee2c6b40b5b29 [file] [log] [blame]
Philip Josephf9c72222016-10-02 23:31:02 +05301#!/usr/bin/env python3
2
3import sys
4sys.path.append('lib')
5
6import argparse
7from charms.layer import options
8
9
10parser = argparse.ArgumentParser(description='Access layer options.')
11parser.add_argument('section',
12 help='the section, or layer, the option is from')
13parser.add_argument('option',
14 help='the option to access')
15
16args = parser.parse_args()
17value = options(args.section).get(args.option, '')
18if isinstance(value, bool):
19 sys.exit(0 if value else 1)
20elif isinstance(value, list):
21 for val in value:
22 print(val)
23else:
24 print(value)