コード例 #1
0
ファイル: linchpin.py プロジェクト: cloudimmense/linch-pin
def validate(config, topo, layout, pf):
    """ validate module of linchpin cli : currenly validates only topologies,
        need to implement PinFile, layouts too"""
    lpcli = LinchpinCli()
    topo = os.path.abspath(topo)
    output = lpcli.lp_validate(topo, layout, pf)
    pprint.pprint(output)
コード例 #2
0
ファイル: linchpin.py プロジェクト: cloudimmense/linch-pin
def layouts_get(config, layout, upstream):
    """
    needs implementation if layout folder is not found raise error
    """
    lpcli = LinchpinCli()
    output = lpcli.lp_layout_get(layout, upstream)
    pprint.pprint(output)
コード例 #3
0
ファイル: linchpin.py プロジェクト: cloudimmense/linch-pin
def topology_get(config, topo, upstream):
    """
    needs implementation if topology folder is not found raise error
    """
    lpcli = LinchpinCli()
    d = lpcli.lp_topo_get(topo)
    pprint.pprint(d)
コード例 #4
0
ファイル: linchpin.py プロジェクト: greg-hellings/linch-pin
def layouts_get(config, layout, upstream):
    """
    Get layout by name
    """
    lpcli = LinchpinCli()
    output = lpcli.lp_layout_get(layout, upstream)
    pprint.pprint(output)
コード例 #5
0
ファイル: linchpin.py プロジェクト: greg-hellings/linch-pin
def topology_get(config, topo, upstream):
    """
    Get topology by name
    """
    lpcli = LinchpinCli()
    d = lpcli.lp_topo_get(topo)
    pprint.pprint(d)
コード例 #6
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_lp_validate_topology(self):
     lp = LinchpinCli()
     base_path = os.path.realpath(__file__)
     base_path = "/".join(base_path.split("/")[0:-2])
     topo = base_path+"/tests/mockdata/ex_all.yml"
     topo = os.path.abspath(topo)
     lp = lp.lp_validate(topo)
     assert_equal(lp, 0)
コード例 #7
0
ファイル: linchpin.py プロジェクト: greg-hellings/linch-pin
def invgen(config, topoout, layout, invout, invtype):
    """ invgen module of linchpin cli """
    topoout = os.path.abspath(topoout)
    layout = os.path.abspath(layout)
    invout = os.path.abspath(invout)
    lpcli = LinchpinCli()
    result = lpcli.lp_invgen(topoout, layout, invout, invtype)
    pprint.pprint(result)
コード例 #8
0
ファイル: linchpin.py プロジェクト: greg-hellings/linch-pin
def validate(config, topo, layout, pf):
    """ validate module of linchpin cli : 
        validates only topologies for now
    """
    lpcli = LinchpinCli()
    topo = os.path.abspath(topo)
    output = lpcli.lp_validate(topo, layout, pf)
    pprint.pprint(output)
コード例 #9
0
ファイル: linchpin.py プロジェクト: cloudimmense/linch-pin
def invgen(config, topoout, layout, invout, invtype):
    """ invgen module of linchpin cli """
    topoout = os.path.abspath(topoout)
    layout = os.path.abspath(layout)
    invout = os.path.abspath(invout)
    lpcli = LinchpinCli()
    result = lpcli.lp_invgen(topoout, layout, invout, invtype)
    pprint.pprint(result)
コード例 #10
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_lp_invgen_with_params(self):
     lp = LinchpinCli()
     of = im.get_mock_outputfile()
     lf = im.get_mock_layoutfile()
     io = os.getcwd()+"/testoutput.txt"
     lp.lp_invgen(of, lf, io, "generic")
     filegenerated = os.path.exists(io)
     os.remove(io)
     assert_equal(filegenerated, True)
コード例 #11
0
ファイル: linchpin.py プロジェクト: cloudimmense/linch-pin
def layouts_list(config, upstream):
    lpcli = LinchpinCli()
    click.echo(": LAYOUTS LIST :")
    files = lpcli.lp_layout_list(upstream)
    t_files = []
    for i in range(0, len(files)):
        t_files.append((i + 1, files[i]["name"]))
    headers = ["Sno", "Name"]
    print tabulate(t_files, headers, tablefmt="fancy_grid")
コード例 #12
0
ファイル: linchpin.py プロジェクト: greg-hellings/linch-pin
def layouts_list(config, upstream):
    lpcli = LinchpinCli()
    click.echo(": LAYOUTS LIST :")
    files = lpcli.lp_layout_list(upstream)
    t_files = []
    for i in range(0, len(files)):
        t_files.append((i+1, files[i]["name"]))
    headers = ["Sno", "Name"]
    print tabulate(t_files, headers, tablefmt="fancy_grid")
コード例 #13
0
ファイル: linchpin.py プロジェクト: cloudimmense/linch-pin
def drop(config, pf, target):
    """ drop module of linchpin cli"""
    init_dir = os.getcwd()
    pfs = list_by_ext(init_dir, "PinFile")
    if len(pfs) == 0:
        display("ERROR:001")
    if len(pfs) > 1:
        display("ERROR:002")
    pf = pfs[0]
    lpcli = LinchpinCli()
    output = lpcli.lp_drop(pf, target)
コード例 #14
0
ファイル: linchpin.py プロジェクト: greg-hellings/linch-pin
def drop(config, pf, target):
    """ drop module of linchpin cli"""
    init_dir = os.getcwd()
    pfs = list_by_ext(init_dir, "PinFile")
    if len(pfs) == 0:
        display("ERROR:001")
    if len(pfs) > 1:
        display("ERROR:002")
    pf = pfs[0]
    lpcli = LinchpinCli()
    output = lpcli.lp_drop(pf, target)
コード例 #15
0
def rise(config, lpf, target):
    """ rise module of linchpin cli """
    init_dir = os.getcwd()
    lpfs = list_by_ext(init_dir, "PinFile")
    if len(lpfs) == 0:
        display("ERROR:001")
    if len(lpfs) > 1:
        display("ERROR:002")
    lpf = lpfs[0]
    lpcli = LinchpinCli()
    output = lpcli.lp_rise(lpf, target)
コード例 #16
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_get_config(self):
     lp = LinchpinCli()
     cfg = lp.get_config()
     keys = ['inventory_layouts_path',
             'inventory_outputs_path',
             'no_output',
             'async_timeout',
             'check_mode',
             'inventory_playbooks',
             'inventory_types',
             'outputfolder_path',
             'async',
             'keystore_path',
             'inventoryfolder_path',
             'schema']
     assert_equal(cfg.keys(), keys)
コード例 #17
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_lp_invgen_without_params(self):
     lp = LinchpinCli()
     lp = lp.lp_invgen()
コード例 #18
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_object_create(self):
     lp = LinchpinCli()
     assert_equal(isinstance(lp, LinchpinCli), True)
コード例 #19
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_lp_validate_topology_without_params(self):
     lp = LinchpinCli()
     lp = lp.lp_validate()
コード例 #20
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_lp_rise_with_wrong_target(self):
     lp = LinchpinCli()
     target = "dosenotexists"
     pf = im.get_mock_pf_path()
     lp.lp_rise(pf, target)
コード例 #21
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_lp_rise_wthout_params(self):
     lp = LinchpinCli()
     lp.lp_rise()
コード例 #22
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_lp_drop_with_wrong_target(self):
     lp = LinchpinCli()
     target = "doesnotexists"
     pf = im.get_mock_pf_path()
     lp.lp_drop(pf, target)
コード例 #23
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_get_evars(self):
     lp = LinchpinCli()
     pf = im.get_mock_pf()
     lp.get_evars(pf)
コード例 #24
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_lp_layout_list_without_params(self):
     lp = LinchpinCli()
     lp = lp.lp_layout_list()
     assert_equal(isinstance(lp, list), True)
コード例 #25
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_get_config_path(self):
     lp = LinchpinCli()
     config_path = lp.get_config_path().split("/")[-1]
     assert_equal("linchpin_config.yml", config_path)
コード例 #26
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_lp_topo_get_with_wrong_input_topo(self):
     lp = LinchpinCli()
     topo = "thisdoesnotexists"
     lp = lp.lp_topo_get(topo)
コード例 #27
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_get_evars_without_pf(self):
     lp = LinchpinCli()
     evars = lp.get_evars()
コード例 #28
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_lp_topo_get_with_wrong_upstream(self):
     lp = LinchpinCli()
     topo = "thisdoesnotexists"
     upstream = "www.example.com"
     lp = lp.lp_topo_get(topo, upstream)
コード例 #29
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_lp_list_without_params(self):
     lp = LinchpinCli()
     lp = lp.lp_list()
コード例 #30
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_lp_layout_get_without_params(self):
     lp = LinchpinCli()
     lp = lp.lp_topo_get()
コード例 #31
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_lp_layout_list_with_wrong_upstream(self):
     lp = LinchpinCli()
     upstream = "www.example.com"
     lp = lp.lp_alyout_list(upstream)
コード例 #32
0
ファイル: test_linchpin_cli.py プロジェクト: seandst/linchpin
 def test_lp_drop_without_params(self):
     lp = LinchpinCli()
     lp.lp_drop()