Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependency.ti: fix typo #8622

Merged
merged 1 commit into from
Feb 5, 2021
Merged

Conversation

Al2Klimov
Copy link
Member

fixes #8180
closes #8197

@Al2Klimov Al2Klimov added bug Something isn't working area/runtime Downtimes, comments, dependencies, events labels Feb 4, 2021
@icinga-probot icinga-probot bot added this to the 2.13.0 milestone Feb 4, 2021
@icinga-probot icinga-probot bot added the area/configuration DSL, parser, compiler, error handling label Feb 4, 2021
@Al2Klimov
Copy link
Member Author

Before

➜  icinga2 git:(master) prefix/sbin/icinga2 api setup -x critical
Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect.
Done.

Now restart your Icinga 2 daemon to finish the installation!

➜  icinga2 git:(master) perl -pi -e 's/\bpassword = ".*?"/password = "123456"/' prefix/etc/icinga2/conf.d/api-users.conf
➜  icinga2 git:(master) prefix/sbin/icinga2 daemon -d
[2021-02-04 18:16:41 +0100] information/cli: Icinga application loader (version: v2.12.0-477-gef23ae5f3)
[2021-02-04 18:16:41 +0100] information/cli: Closing console log.
➜  icinga2 git:(master) curl -k -s -u root:123456 -H 'Accept: application/json' -X PUT -d '{"attrs":{"check_command":"dummy"}}' 'https://localhost:5665/v1/objects/hosts/a?pretty=1'
{
    "results": [
        {
            "code": 200.0,
            "status": "Object was created"
        }
    ]
}
➜  icinga2 git:(master) curl -k -s -u root:123456 -H 'Accept: application/json' -X PUT -d '{"attrs":{"check_command":"dummy"}}' 'https://localhost:5665/v1/objects/hosts/c?pretty=1'
{
    "results": [
        {
            "code": 200.0,
            "status": "Object was created"
        }
    ]
}
➜  icinga2 git:(master) curl -k -s -u root:123456 -H 'Accept: application/json' -X PUT -d '{"attrs":{"check_command":"dummy"}}' 'https://localhost:5665/v1/objects/services/a!b?pretty=1'
{
    "results": [
        {
            "code": 200.0,
            "status": "Object was created"
        }
    ]
}
➜  icinga2 git:(master) curl -k -s -u root:123456 -H 'Accept: application/json' -X PUT -d '{"attrs":{"check_command":"dummy"}}' 'https://localhost:5665/v1/objects/services/c!d?pretty=1'
{
    "results": [
        {
            "code": 200.0,
            "status": "Object was created"
        }
    ]
}
➜  icinga2 git:(master) curl -k -s -u root:123456 -H 'Accept: application/json' -X PUT -d '{"attrs":{"parent_host_name":"a","parent_service_name":"b"}}' 'https://localhost:5665/v1/objects/dependencies/c!d!e?pretty=1'
{
    "results": [
        {
            "code": 200.0,
            "status": "Object was created"
        }
    ]
}
➜  icinga2 git:(master) curl -k -s -u root:123456 -H 'Accept: application/json' -X PUT -d '{"attrs":{"parent_host_name":"a"}}' 'https://localhost:5665/v1/objects/dependencies/c!d!f?pretty=1'
{
    "results": [
        {
            "code": 200.0,
            "status": "Object was created"
        }
    ]
}
➜  icinga2 git:(master) curl -k -s -u root:123456 -H 'Accept: application/json' -X GET -d '{"attrs":["parent_host_name","parent_service_name","child_host_name","child_service_name"]}' 'https://localhost:5665/v1/objects/dependencies?pretty=1'
{
    "results": [
        {
            "attrs": {
                "child_host_name": "c",
                "child_service_name": "d",
                "parent_host_name": "a",
                "parent_service_name": "b"
            },
            "joins": {},
            "meta": {},
            "name": "c!d!e",
            "type": "Dependency"
        },
        {
            "attrs": {
                "child_host_name": "c",
                "child_service_name": "d",
                "parent_host_name": "a",
                "parent_service_name": ""
            },
            "joins": {},
            "meta": {},
            "name": "c!d!f",
            "type": "Dependency"
        }
    ]
}
➜  icinga2 git:(master) curl -k -s -u root:123456 -H 'Accept: application/json' -X DELETE 'https://localhost:5665/v1/objects/services/c!d?pretty=1&cascade=1'
{
    "results": [
        {
            "code": 200.0,
            "errors": [],
            "name": "c!d",
            "status": "Object was deleted.",
            "type": "Service"
        }
    ]
}
➜  icinga2 git:(master) curl -k -s -u root:123456 -H 'Accept: application/json' -X GET -d '{"attrs":["parent_host_name","parent_service_name","child_host_name","child_service_name"]}' 'https://localhost:5665/v1/objects/dependencies?pretty=1'
{
    "results": [
        {
            "attrs": {
                "child_host_name": "c",
                "child_service_name": "d",
                "parent_host_name": "a",
                "parent_service_name": "b"
            },
            "joins": {},
            "meta": {},
            "name": "c!d!e",
            "type": "Dependency"
        },
        {
            "attrs": {
                "child_host_name": "c",
                "child_service_name": "d",
                "parent_host_name": "a",
                "parent_service_name": ""
            },
            "joins": {},
            "meta": {},
            "name": "c!d!f",
            "type": "Dependency"
        }
    ]
}
➜  icinga2 git:(master)

After

➜  icinga2 git:(bugfix/dependency-ti-typo-8180) prefix/sbin/icinga2 api setup -x critical
Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect.
Done.

Now restart your Icinga 2 daemon to finish the installation!

➜  icinga2 git:(bugfix/dependency-ti-typo-8180) perl -pi -e 's/\bpassword = ".*?"/password = "123456"/' prefix/etc/icinga2/conf.d/api-users.conf
➜  icinga2 git:(bugfix/dependency-ti-typo-8180) prefix/sbin/icinga2 daemon -d
[2021-02-04 18:31:27 +0100] information/cli: Icinga application loader (version: v2.12.0-478-gebfa73388)
[2021-02-04 18:31:27 +0100] information/cli: Closing console log.
➜  icinga2 git:(bugfix/dependency-ti-typo-8180) curl -k -s -u root:123456 -H 'Accept: application/json' -X PUT -d '{"attrs":{"check_command":"dummy"}}' 'https://localhost:5665/v1/objects/hosts/a?pretty=1'
{
    "results": [
        {
            "code": 200.0,
            "status": "Object was created"
        }
    ]
}
➜  icinga2 git:(bugfix/dependency-ti-typo-8180) curl -k -s -u root:123456 -H 'Accept: application/json' -X PUT -d '{"attrs":{"check_command":"dummy"}}' 'https://localhost:5665/v1/objects/hosts/c?pretty=1'
{
    "results": [
        {
            "code": 200.0,
            "status": "Object was created"
        }
    ]
}
➜  icinga2 git:(bugfix/dependency-ti-typo-8180) curl -k -s -u root:123456 -H 'Accept: application/json' -X PUT -d '{"attrs":{"check_command":"dummy"}}' 'https://localhost:5665/v1/objects/services/a!b?pretty=1'
{
    "results": [
        {
            "code": 200.0,
            "status": "Object was created"
        }
    ]
}
➜  icinga2 git:(bugfix/dependency-ti-typo-8180) curl -k -s -u root:123456 -H 'Accept: application/json' -X PUT -d '{"attrs":{"check_command":"dummy"}}' 'https://localhost:5665/v1/objects/services/c!d?pretty=1'
{
    "results": [
        {
            "code": 200.0,
            "status": "Object was created"
        }
    ]
}
➜  icinga2 git:(bugfix/dependency-ti-typo-8180) curl -k -s -u root:123456 -H 'Accept: application/json' -X PUT -d '{"attrs":{"parent_host_name":"a","parent_service_name":"b"}}' 'https://localhost:5665/v1/objects/dependencies/c!d!e?pretty=1'
{
    "results": [
        {
            "code": 200.0,
            "status": "Object was created"
        }
    ]
}
➜  icinga2 git:(bugfix/dependency-ti-typo-8180) curl -k -s -u root:123456 -H 'Accept: application/json' -X PUT -d '{"attrs":{"parent_host_name":"a"}}' 'https://localhost:5665/v1/objects/dependencies/c!d!f?pretty=1'
{
    "results": [
        {
            "code": 200.0,
            "status": "Object was created"
        }
    ]
}
➜  icinga2 git:(bugfix/dependency-ti-typo-8180) curl -k -s -u root:123456 -H 'Accept: application/json' -X GET -d '{"attrs":["parent_host_name","parent_service_name","child_host_name","child_service_name"]}' 'https://localhost:5665/v1/objects/dependencies?pretty=1'
{
    "results": [
        {
            "attrs": {
                "child_host_name": "c",
                "child_service_name": "d",
                "parent_host_name": "a",
                "parent_service_name": "b"
            },
            "joins": {},
            "meta": {},
            "name": "c!d!e",
            "type": "Dependency"
        },
        {
            "attrs": {
                "child_host_name": "c",
                "child_service_name": "d",
                "parent_host_name": "a",
                "parent_service_name": ""
            },
            "joins": {},
            "meta": {},
            "name": "c!d!f",
            "type": "Dependency"
        }
    ]
}
➜  icinga2 git:(bugfix/dependency-ti-typo-8180) curl -k -s -u root:123456 -H 'Accept: application/json' -X DELETE 'https://localhost:5665/v1/objects/services/c!d?pretty=1&cascade=1'
{
    "results": [
        {
            "code": 200.0,
            "errors": [],
            "name": "c!d",
            "status": "Object was deleted.",
            "type": "Service"
        }
    ]
}
➜  icinga2 git:(bugfix/dependency-ti-typo-8180) curl -k -s -u root:123456 -H 'Accept: application/json' -X GET -d '{"attrs":["parent_host_name","parent_service_name","child_host_name","child_service_name"]}' 'https://localhost:5665/v1/objects/dependencies?pretty=1'
{
    "results": []
}
➜  icinga2 git:(bugfix/dependency-ti-typo-8180)

@Al2Klimov Al2Klimov requested a review from julianbrost February 4, 2021 17:35
@julianbrost julianbrost merged commit ddbad79 into master Feb 5, 2021
@Al2Klimov Al2Klimov deleted the bugfix/dependency-ti-typo-8180 branch May 26, 2021 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration DSL, parser, compiler, error handling area/runtime Downtimes, comments, dependencies, events bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Icinga2 API: deleting Service with cascade=1 does not delete its related dependencies
2 participants