Coder Social home page Coder Social logo

Comments (7)

orachide avatar orachide commented on August 16, 2024

Hello,

Thanks for your interest to this project.

I'am not sure about what wrong in your case (the error msg said result has no attribute status that mean the uri module fail to request your url), but could you please re-execute your playbook with -vvv to have more verbose details.

Maybe it's a self signed certificate issue with this URL httpS://localhost:8443/health

If it is a certificate issue, you can add validate_certs: no to the uri module parameters, i'll patch this very soon to allow to configure this for the role.

Let me know !!

from ansible-role-springboot.

japneet-sahni avatar japneet-sahni commented on August 16, 2024

Hello,

This is the verbose details for the above error. I had added validate_certs: no as well in uri module parameters.

Verbose Details given below

`TASK [service_substitution : Healthcheck | Wait for substitution application to be healthy on URLs https://localhost:8443/health] ***

<198.18.XX.XXX> ESTABLISH SSH CONNECTION FOR USER: XXXXXXX
<198.18.XX.XXX> (0, '\r\n{"status": 200, "cookies": {}, "date": "Tue, 17 Jul 2018 12:40:57 GMT", "x_application_context": "one-substitutions:8443", "url": "https://localhost:8443/health", "transfer_encoding": "chunked", "changed": false, "vary": "Accept-Encoding", "connection": "close", "invocation": {"module_args": {"directory_mode": null, "force": false, "remote_src": null, "status_code": ["200"], "body_format": "raw", "owner": null, "follow": false, "client_key": null, "group": null, "use_proxy": true, "unsafe_writes": null, "setype": null, "content": null, "serole": null, "follow_redirects": "safe", "return_content": false, "method": "GET", "body": null, "timeout": 30, "src": null, "dest": null, "selevel": null, "force_basic_auth": false, "removes": null, "http_agent": "ansible-httpget", "regexp": null, "url_password": null, "url": "https://localhost:8443/health", "validate_certs": false, "seuser": null, "client_cert": null, "creates": null, "headers": {}, "delimiter": null, "mode": null, "url_username": null, "attributes": null, "backup": null}}, "json": {"status":"UP","serviceProductSubstitutionsHealthCheck":{"status":"UP"},"diskSpace":{"status":"UP"},"couchbase":{"status":"UP"},"hystrix":{"status":"UP"}}, "content_type": "application/json;charset=UTF-8", "msg": "OK (unknown bytes)", "redirected": false}\r\n', 'Shared connection to 198.18.XX.XXX closed.\r\n')
fatal: [sbs-sint-spr1]: FAILED! => {"msg": "The conditional check 'result.status == 200' failed. The error was: error while evaluating conditional (result.status == 200): 'dict object' has no attribute 'status'"}`

from ansible-role-springboot.

orachide avatar orachide commented on August 16, 2024

Here is your formated result:

{
    "status": 200, // As you can see the status exist in the result and status == 200 as expected
    "cookies": {

    },
    "date": "Tue, 17 Jul 2018 12:40:57 GMT",
    "x_application_context": "one-substitutions:8443",
    "url": "https://localhost:8443/health",
    "transfer_encoding": "chunked",
    "changed": false,
    "vary": "Accept-Encoding",
    "connection": "close",
    "invocation": {
        "module_args": {
            "directory_mode": null,
            "force": false,
            "remote_src": null,
            "status_code": [
                "200"
            ],
            "body_format": "raw",
            "owner": null,
            "follow": false,
            "client_key": null,
            "group": null,
            "use_proxy": true,
            "unsafe_writes": null,
            "setype": null,
            "content": null,
            "serole": null,
            "follow_redirects": "safe",
            "return_content": false,
            "method": "GET",
            "body": null,
            "timeout": 30,
            "src": null,
            "dest": null,
            "selevel": null,
            "force_basic_auth": false,
            "removes": null,
            "http_agent": "ansible-httpget",
            "regexp": null,
            "url_password": null,
            "url": "https://localhost:8443/health",
            "validate_certs": false,
            "seuser": null,
            "client_cert": null,
            "creates": null,
            "headers": {

            },
            "delimiter": null,
            "mode": null,
            "url_username": null,
            "attributes": null,
            "backup": null
        }
    },
    "json": {
        "status": "UP",
        "serviceProductSubstitutionsHealthCheck": {
            "status": "UP"
        },
        "diskSpace": {
            "status": "UP"
        },
        "couchbase": {
            "status": "UP"
        },
        "hystrix": {
            "status": "UP"
        }
    },
    "content_type": "application/json;charset=UTF-8",
    "msg": "OK (unknown bytes)",
    "redirected": false
}

What is your ansible version ansible --version ?

Anyway my advice is to use the role from galaxy ansible-galaxy install orachide.springboot-service to use it or just Fork this repository.

Regarding your result, the https call works well, it seem you have an issue with the
register: result part

from ansible-role-springboot.

japneet-sahni avatar japneet-sahni commented on August 16, 2024

It worked after I changed my task to below (marked in bold)

  • name: "Healthcheck | Wait for substitution application to be healthy"
    uri:
    url: "{{ item }}"
    method: GET
    status_code: 200
    validate_certs: no
    register: result
    until: ('status' in result) and (result.status == 200)
    changed_when: false

    retries: 4
    delay: 10
    with_items: "https://localhost:8443/health"
    when: substitution_healthcheck_url is defined

from ansible-role-springboot.

orachide avatar orachide commented on August 16, 2024

Great !

But please let me know what is your ansible version ansible --version ?

I need to check if that was the real issue.

from ansible-role-springboot.

japneet-sahni avatar japneet-sahni commented on August 16, 2024

It's ansible 2.4.2.0

from ansible-role-springboot.

orachide avatar orachide commented on August 16, 2024

I close the isssue as it works for you. Could not reproduce on my side with the same version of ansible.
Also noticed that your are not using the role (you have customize some part of it)

from ansible-role-springboot.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.