{"action":"created","issue":{"url":"https://api.github.com/repos/OpenSCAP/scap-security-guide/issues/575","labels_url":"https://api.github.com/repos/OpenSCAP/scap-security-guide/issues/575/labels{/name}","comments_url":"https://api.github.com/repos/OpenSCAP/scap-security-guide/issues/575/comments","events_url":"https://api.github.com/repos/OpenSCAP/scap-security-guide/issues/575/events","html_url":"https://github.com/OpenSCAP/scap-security-guide/pull/575","id":86240204,"number":575,"title":"[BugFix] [Infrastructure] Fix testcheck.py bug when replacing external variables","user":{"login":"iankko","id":8414918,"avatar_url":"https://avatars.githubusercontent.com/u/8414918?v=3","gravatar_id":"","url":"https://api.github.com/users/iankko","html_url":"https://github.com/iankko","followers_url":"https://api.github.com/users/iankko/followers","following_url":"https://api.github.com/users/iankko/following{/other_user}","gists_url":"https://api.github.com/users/iankko/gists{/gist_id}","starred_url":"https://api.github.com/users/iankko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iankko/subscriptions","organizations_url":"https://api.github.com/users/iankko/orgs","repos_url":"https://api.github.com/users/iankko/repos","events_url":"https://api.github.com/users/iankko/events{/privacy}","received_events_url":"https://api.github.com/users/iankko/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/OpenSCAP/scap-security-guide/labels/bugfix","name":"bugfix","color":"fbca04"},{"url":"https://api.github.com/repos/OpenSCAP/scap-security-guide/labels/Infrastructure","name":"Infrastructure","color":"5319e7"}],"state":"open","locked":false,"assignee":{"login":"mpreisler","id":753153,"avatar_url":"https://avatars.githubusercontent.com/u/753153?v=3","gravatar_id":"","url":"https://api.github.com/users/mpreisler","html_url":"https://github.com/mpreisler","followers_url":"https://api.github.com/users/mpreisler/followers","following_url":"https://api.github.com/users/mpreisler/following{/other_user}","gists_url":"https://api.github.com/users/mpreisler/gists{/gist_id}","starred_url":"https://api.github.com/users/mpreisler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpreisler/subscriptions","organizations_url":"https://api.github.com/users/mpreisler/orgs","repos_url":"https://api.github.com/users/mpreisler/repos","events_url":"https://api.github.com/users/mpreisler/events{/privacy}","received_events_url":"https://api.github.com/users/mpreisler/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/OpenSCAP/scap-security-guide/milestones/6","html_url":"https://github.com/OpenSCAP/scap-security-guide/milestones/0.1.23","labels_url":"https://api.github.com/repos/OpenSCAP/scap-security-guide/milestones/6/labels","id":776809,"number":6,"title":"0.1.23","description":"","creator":{"login":"redhatrises","id":8398836,"avatar_url":"https://avatars.githubusercontent.com/u/8398836?v=3","gravatar_id":"","url":"https://api.github.com/users/redhatrises","html_url":"https://github.com/redhatrises","followers_url":"https://api.github.com/users/redhatrises/followers","following_url":"https://api.github.com/users/redhatrises/following{/other_user}","gists_url":"https://api.github.com/users/redhatrises/gists{/gist_id}","starred_url":"https://api.github.com/users/redhatrises/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redhatrises/subscriptions","organizations_url":"https://api.github.com/users/redhatrises/orgs","repos_url":"https://api.github.com/users/redhatrises/repos","events_url":"https://api.github.com/users/redhatrises/events{/privacy}","received_events_url":"https://api.github.com/users/redhatrises/received_events","type":"User","site_admin":false},"open_issues":18,"closed_issues":22,"state":"open","created_at":"2014-09-03T13:35:06Z","updated_at":"2015-06-08T16:15:50Z","due_on":"2015-06-19T22:00:00Z","closed_at":null},"comments":2,"created_at":"2015-06-08T16:15:50Z","updated_at":"2015-06-08T17:23:32Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/OpenSCAP/scap-security-guide/pulls/575","html_url":"https://github.com/OpenSCAP/scap-security-guide/pull/575","diff_url":"https://github.com/OpenSCAP/scap-security-guide/pull/575.diff","patch_url":"https://github.com/OpenSCAP/scap-security-guide/pull/575.patch"},"body":"Fixes the following issue (introduced by https://github.com/OpenSCAP/scap-security-guide/commit/b37a13dc4efe1f9b36575c511750db66294190e9):\r\n\r\n```\r\n[iankko@host scap-security-guide]$ cd shared/oval/\r\n[iankko@host oval]$ ./testcheck.py account_disable_post_pw_expiration.xml\r\nExternal_variable with id : var_account_disable_post_pw_expiration\r\nExternal_variable specified, but no value provided via environment variable\r\n[iankko@host oval]$ export var_account_disable_post_pw_expiration=10\r\n[iankko@host oval]$ ./testcheck.py account_disable_post_pw_expiration.xml\r\nExternal_variable with id : var_account_disable_post_pw_expiration\r\nTraceback (most recent call last):\r\n  File \"./testcheck.py\", line 11, in <module>\r\n    testcheck_module.main()\r\n  File \"../modules/testcheck_module.py\", line 154, in main\r\n    defname = add_oval_elements(body)\r\n  File \"../modules/testcheck_module.py\", line 58, in add_oval_elements\r\n    tree = replace_external_vars(tree)\r\n  File \"../modules/testcheck_module.py\", line 107, in replace_external_vars\r\n    append(node, literal)\r\n  File \"../modules/testcheck_module.py\", line 44, in append\r\n    existing = element.find(\".//*[@id='\" + newid + \"']\")\r\nTypeError: cannot concatenate 'str' and 'NoneType' objects\r\n[iankko@host oval]$\r\n```\r\nAfter this change is applied, the output for same check is as follows:\r\n```\r\n[iankko@host scap-security-guide]$ cd shared/oval/\r\n[iankko@host oval]$ ./testcheck.py account_disable_post_pw_expiration.xml\r\nExternal_variable with id : var_account_disable_post_pw_expiration\r\nEvaluating with OVAL tempfile : /tmp/account_disable_post_pw_expirationwoxAT0.xml\r\nWriting results to : /tmp/account_disable_post_pw_expirationwoxAT0.xml-results\r\nDefinition oval:scap-security-guide.testing:def:100: false\r\nEvaluation done.\r\n```\r\n\r\nPlease review.\r\n\r\nThank you, Jan."},"comment":{"url":"https://api.github.com/repos/OpenSCAP/scap-security-guide/issues/comments/110082665","html_url":"https://github.com/OpenSCAP/scap-security-guide/pull/575#issuecomment-110082665","issue_url":"https://api.github.com/repos/OpenSCAP/scap-security-guide/issues/575","id":110082665,"user":{"login":"mpreisler","id":753153,"avatar_url":"https://avatars.githubusercontent.com/u/753153?v=3","gravatar_id":"","url":"https://api.github.com/users/mpreisler","html_url":"https://github.com/mpreisler","followers_url":"https://api.github.com/users/mpreisler/followers","following_url":"https://api.github.com/users/mpreisler/following{/other_user}","gists_url":"https://api.github.com/users/mpreisler/gists{/gist_id}","starred_url":"https://api.github.com/users/mpreisler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpreisler/subscriptions","organizations_url":"https://api.github.com/users/mpreisler/orgs","repos_url":"https://api.github.com/users/mpreisler/repos","events_url":"https://api.github.com/users/mpreisler/events{/privacy}","received_events_url":"https://api.github.com/users/mpreisler/received_events","type":"User","site_admin":false},"created_at":"2015-06-08T17:23:32Z","updated_at":"2015-06-08T17:23:32Z","body":"ACK"}}