예제 #1
0
파일: cli.py 프로젝트: kxr/o-must-gather
def cli(loglevel, path, namespace, all_namespaces):
    logging.setup_logging(loglevel)
    if path:
        config.filtered_path = path
    if namespace:
        config.namespace = namespace
    if all_namespaces:
        config.all_namespaces = all_namespaces
예제 #2
0
파일: cli.py 프로젝트: kxr/o-must-gather
def projects_cmd(path, loglevel):
    """
    Display existing projects
    """
    if loglevel:
        logging.setup_logging(loglevel)
    if path:
        config.filtered_path = path
    projects.cmd()
예제 #3
0
파일: cli.py 프로젝트: kxr/o-must-gather
def project_cmd(name, loglevel, path):
    """
    Switch to another project
    """
    if loglevel:
        logging.setup_logging(loglevel)
    if path:
        config.filtered_path = path
    project.cmd(name)
예제 #4
0
파일: cli.py 프로젝트: kxr/o-must-gather
def use_cmd(mg_paths, cwd, loglevel, path):
    """
    Select one or more must-gather(s) to use
    """
    if loglevel:
        logging.setup_logging(loglevel)
    if path:
        config.filtered_path = path
    use.cmd(mg_paths, cwd)
예제 #5
0
파일: cli.py 프로젝트: kxr/o-must-gather
def compare_mc_cmd(mc_names, show_contents, loglevel, path):
    """
    Compare Machine Configs
    """
    if loglevel:
        logging.setup_logging(loglevel)
    if path:
        config.filtered_path = path
    mc_compare(mc_names, show_contents)
예제 #6
0
파일: cli.py 프로젝트: kxr/o-must-gather
def extract_mc_cmd(mc_names, loglevel, path):
    """
    Extract Machine Configs
    """
    if loglevel:
        logging.setup_logging(loglevel)
    if path:
        config.filtered_path = path
    mc_extract(mc_names)
예제 #7
0
파일: cli.py 프로젝트: kxr/o-must-gather
def logs_cmd(resource, container, previous, namespace, loglevel, path):
    """
    Print the logs for a container in a pod
    """
    if loglevel:
        logging.setup_logging(loglevel)
    if path:
        config.filtered_path = path
    if namespace:
        config.namespace = namespace
    log.cmd(resource, container, previous)
예제 #8
0
파일: cli.py 프로젝트: kxr/o-must-gather
def get_cmd(objects, output, show_labels, loglevel, namespace, all_namespaces,
            path):
    """
    Display one or many resources
    """
    if loglevel:
        logging.setup_logging(loglevel)
    if path:
        config.filtered_path = path
    if namespace:
        config.namespace = namespace
    if all_namespaces:
        config.all_namespaces = all_namespaces
    get.cmd(objects, output, show_labels)
예제 #9
0
import os
import yaml
from omg.use import use
from omg.config.logging import setup_logging

setup_logging(loglevel="normal")


def test_use_invalid_paths(caplog):
    use.cmd(mg_paths=('/non/exitent/path', ))
    assert "No valid must-gather(s) found in ('/non/exitent/path',)" in caplog.text


def test_use_simple_must_gather(caplog, omgconfig, simple_must_gather):
    use.cmd(mg_paths=(simple_must_gather, ), cfile=omgconfig)
    with open(omgconfig, "r") as omgcfg:
        cfg = yaml.load(omgcfg.read(), Loader=yaml.SafeLoader)
    for path in cfg["paths"]:
        assert os.path.isdir(path)
        assert (os.path.isdir(os.path.join(path, "namespaces")) or
                os.path.isdir(os.path.join(path, "cluster-scoped-resources")))

    assert "quay-io-openshift-release-dev-ocp-v4-0-art-dev-sha256*" in caplog.text
    assert "Cluster API URL: ['https://api.ocp46.v.kxr.me:6443']" in caplog.text
    assert "Cluster Platform: ['VSphere']" in caplog.text
    assert "Cluster ID: ['51611b91-5e45-4246-8b64-b3da2ed6ad22']" in caplog.text
    assert "Desired Version: ['4.6.16']" in caplog.text


# TODO: test_use_multidir_must_gather
예제 #10
0
파일: cli.py 프로젝트: kxr/o-must-gather
def etcdctl_cmd(etcdctl_args, output, loglevel, path):
    if loglevel:
        logging.setup_logging(loglevel)
    if path:
        config.filtered_path = path
    etcdctl.cmd(etcdctl_args, output)
예제 #11
0
파일: cli.py 프로젝트: kxr/o-must-gather
def rbd_cmd(ceph_args, loglevel, path):
    if loglevel:
        logging.setup_logging(loglevel)
    if path:
        config.filtered_path = path
    ceph.cmd(ceph_args, None, com="rbd")
예제 #12
0
파일: cli.py 프로젝트: kxr/o-must-gather
def ceph_cmd(ceph_args, output, loglevel, path):
    if loglevel:
        logging.setup_logging(loglevel)
    if path:
        config.filtered_path = path
    ceph.cmd(ceph_args, output, com="ceph")
예제 #13
0
from omg.config.logging import setup_logging
from omg.must_gather.load_resources import load_res

setup_logging("info")

paths = [
    '/home/knaeem/Desktop/mgs/must-gather.etism/registry-redhat-io-openshift-service-mesh-istio-must-gather-rhel7-sha256-b73931d591587f34e94fd79de84b557417b817616a04631e6c741268b47d9d05',
    '/home/knaeem/Desktop/mgs/must-gather.etism/quay-io-openshift-release-dev-ocp-v4-0-art-dev-sha256-2f3d142d13081954fc73e1d5e6ee96a04ba7c5714e9193f985d0a6962d325841'
]

# config = Config()
# config.paths = paths
# config.project = "openshift-apiserver"

res = load_res(paths, "configmap", ns="openshift-config")

for r in res:
    rs = r["res"]
    print(rs["metadata"]["name"])