Exemplo n.º 1
0
#!/usr/bin/env python
from himlarcli.parser import Parser
from himlarcli.printer import Printer
from himlarcli.foremanclient import ForemanClient

parser = Parser()
parser.toggle_show('dry-run')
parser.set_default_format('json')
options = parser.parse_args()
printer = Printer(options.format)

foreman = ForemanClient(options.config, options.debug)

hosts = options.hosts

mapping = {}

for host in hosts:
    fact = foreman.get_fact(host, options.fact)
    mapping[host] = fact

printer.output_dict(mapping)
Exemplo n.º 2
0
from himlarcli import tests as tests
tests.is_virtual_env()

from himlarcli.keystone import Keystone
from himlarcli.nova import Nova
from himlarcli.cinder import Cinder
from himlarcli.mail import Mail
from himlarcli.parser import Parser
from himlarcli.printer import Printer
from himlarcli import utils
from datetime import date

parser = Parser()
options = parser.parse_args()
printer = Printer(options.format)

kc = Keystone(options.config, debug=options.debug)
kc.set_domain(options.domain)
kc.set_dry_run(options.dry_run)
logger = kc.get_logger()

# Region
if hasattr(options, 'region'):
    regions = kc.find_regions(region_name=options.region)
else:
    regions = kc.find_regions()


def action_list():
    projects = kc.get_projects(type='demo')