{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/molecule/issues/1632","repository_url":"https://api.github.com/repos/ansible/molecule","labels_url":"https://api.github.com/repos/ansible/molecule/issues/1632/labels{/name}","comments_url":"https://api.github.com/repos/ansible/molecule/issues/1632/comments","events_url":"https://api.github.com/repos/ansible/molecule/issues/1632/events","html_url":"https://github.com/ansible/molecule/issues/1632","id":392144631,"node_id":"MDU6SXNzdWUzOTIxNDQ2MzE=","number":1632,"title":"Idempotence test fails while using custom docker","user":{"login":"anis016","id":6690216,"node_id":"MDQ6VXNlcjY2OTAyMTY=","avatar_url":"https://avatars0.githubusercontent.com/u/6690216?v=4","gravatar_id":"","url":"https://api.github.com/users/anis016","html_url":"https://github.com/anis016","followers_url":"https://api.github.com/users/anis016/followers","following_url":"https://api.github.com/users/anis016/following{/other_user}","gists_url":"https://api.github.com/users/anis016/gists{/gist_id}","starred_url":"https://api.github.com/users/anis016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anis016/subscriptions","organizations_url":"https://api.github.com/users/anis016/orgs","repos_url":"https://api.github.com/users/anis016/repos","events_url":"https://api.github.com/users/anis016/events{/privacy}","received_events_url":"https://api.github.com/users/anis016/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-18T12:56:54Z","updated_at":"2018-12-21T15:13:13Z","closed_at":null,"author_association":"NONE","body":"# Issue Type\r\n\r\n- Bug report\r\n\r\n# Molecule and Ansible details\r\n\r\n```\r\nansible --version && molecule --version\r\n```\r\nansible 2.7.2\r\n  config file = None\r\n  configured module search path = [u'/home/sayed/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']\r\n  ansible python module location = /home/sayed/ultra_patch/docker-hive-database/py2.7-venv/local/lib/python2.7/site-packages/ansible\r\n  executable location = /home/sayed/ultra_patch/docker-hive-database/py2.7-venv/bin/ansible\r\n  python version = 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]\r\nmolecule, version 2.19.0\r\n\r\nMolecule installation method (one of):\r\n\r\n- pip\r\n\r\nAnsible installation method (one of):\r\n\r\n- pip\r\n\r\nDetail any linters or test runners used:\r\n\r\n# Desired Behavior\r\n\r\nAll the test cases should be passed\r\n\r\nPlease give some details of the feature being requested or what\r\nshould happen if providing a bug report.\r\n\r\n# Actual Behaviour\r\n\r\nI created a custom docker, named - `custom-docker` to work with the molecule. Inside the docker Hive is setup and is accessible via Beeline. I wrote the testcase to access the Hive in the docker image and the test case passes.\r\n\r\nNext, I created a playbook tasks as follows\r\n\r\n```\r\n---\r\n- name: Create Hive database\r\n  hive_database:\r\n    name: \"{{ database_name }}\"\r\n    ensure: present\r\n```\r\n\r\nWhere the `hive_database` (I can't enclose full source code) tasks looks something like below.\r\n\r\n```\r\n#!/usr/bin/env bash\r\nfunction create_database {\r\n    beeline -u jdbc:hive2://localhost:10000 --silent=true --showHeader=false --outputformat=csv2 -e \"show databases\" | grep ${name}\r\n\r\n    if [[ $? -eq 0 ]]; then\r\n        changed=\"false\"\r\n        message=\"Database $name already exists\"\r\n    else\r\n        beeline -u jdbc:hive2://localhost:10000 --silent=true --showHeader=false --outputformat=csv2 -e \"create database $name\"\r\n        changed=\"true\"\r\n        message=\"Database $name created\"\r\n    fi\r\n}\r\n...\r\n...\r\n...\r\n``` \r\n\r\nNow when I run `molecule test` it only shows the below error:\r\n\r\n```\r\nERROR: Idempotence test failed because of the following tasks:\r\n* [custom-docker] => hive-database : Create Hive database\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/molecule/issues/comments/449413445","html_url":"https://github.com/ansible/molecule/issues/1632#issuecomment-449413445","issue_url":"https://api.github.com/repos/ansible/molecule/issues/1632","id":449413445,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0OTQxMzQ0NQ==","user":{"login":"AlexisLessard","id":10947093,"node_id":"MDQ6VXNlcjEwOTQ3MDkz","avatar_url":"https://avatars0.githubusercontent.com/u/10947093?v=4","gravatar_id":"","url":"https://api.github.com/users/AlexisLessard","html_url":"https://github.com/AlexisLessard","followers_url":"https://api.github.com/users/AlexisLessard/followers","following_url":"https://api.github.com/users/AlexisLessard/following{/other_user}","gists_url":"https://api.github.com/users/AlexisLessard/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexisLessard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexisLessard/subscriptions","organizations_url":"https://api.github.com/users/AlexisLessard/orgs","repos_url":"https://api.github.com/users/AlexisLessard/repos","events_url":"https://api.github.com/users/AlexisLessard/events{/privacy}","received_events_url":"https://api.github.com/users/AlexisLessard/received_events","type":"User","site_admin":false},"created_at":"2018-12-21T15:13:13Z","updated_at":"2018-12-21T15:13:13Z","author_association":"NONE","body":"Have you tried running your role in a virtual machine? Sometimes, the behaviour in a vm and in a container aren't the same, so that might be a cause. If the role is still not idempotent, maybe the module itself is at fault. I've had issues with the iptables module. I would run it a few time without any changes, but it would always show _changed_, even tough I just added the same rule a few second ago... I'm no expert, but I'm not sure the error is from molecule itself."}}
{"actor":{"display_login":"AlexisLessard"}}