{"action":"created","comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/pulls/comments/33890091","id":33890091,"diff_hunk":"@@ -596,39 +624,27 @@ def main():\n             # reopen cache w/ modified config\n             cache.open(progress=None)\n \n-        if p['update_cache']:\n-            # Default is: always update the cache\n-            cache_valid = False\n+        mtimestamp, updated_cache_time = get_updated_cache_time()\n+        # Cache valid time is default 0, which will update the cache if\n+        #  needed and `update_cache` was set to true\n+        updated_cache = False\n+        if p['update_cache'] or p['cache_valid_time']:","path":"packaging/os/apt.py","position":65,"original_position":65,"commit_id":"903c9265c781bf5445d0d0b599035bb456d919ef","original_commit_id":"903c9265c781bf5445d0d0b599035bb456d919ef","user":{"login":"bcoca","id":836171,"avatar_url":"https://avatars.githubusercontent.com/u/836171?v=3","gravatar_id":"","url":"https://api.github.com/users/bcoca","html_url":"https://github.com/bcoca","followers_url":"https://api.github.com/users/bcoca/followers","following_url":"https://api.github.com/users/bcoca/following{/other_user}","gists_url":"https://api.github.com/users/bcoca/gists{/gist_id}","starred_url":"https://api.github.com/users/bcoca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcoca/subscriptions","organizations_url":"https://api.github.com/users/bcoca/orgs","repos_url":"https://api.github.com/users/bcoca/repos","events_url":"https://api.github.com/users/bcoca/events{/privacy}","received_events_url":"https://api.github.com/users/bcoca/received_events","type":"User","site_admin":false},"body":"this changes the behavior and now setting a cache_valid_time implies updated_cache=True","created_at":"2015-07-04T21:20:39Z","updated_at":"2015-07-04T21:20:39Z","html_url":"https://github.com/ansible/ansible-modules-core/pull/1517#discussion_r33890091","pull_request_url":"https://api.github.com/repos/ansible/ansible-modules-core/pulls/1517","_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible-modules-core/pulls/comments/33890091"},"html":{"href":"https://github.com/ansible/ansible-modules-core/pull/1517#discussion_r33890091"},"pull_request":{"href":"https://api.github.com/repos/ansible/ansible-modules-core/pulls/1517"}}},"pull_request":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/pulls/1517","id":37636812,"html_url":"https://github.com/ansible/ansible-modules-core/pull/1517","diff_url":"https://github.com/ansible/ansible-modules-core/pull/1517.diff","patch_url":"https://github.com/ansible/ansible-modules-core/pull/1517.patch","issue_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/1517","number":1517,"state":"open","locked":false,"title":"Fixes issue #1497 within the apt module","user":{"login":"cloudnull","id":2066292,"avatar_url":"https://avatars.githubusercontent.com/u/2066292?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudnull","html_url":"https://github.com/cloudnull","followers_url":"https://api.github.com/users/cloudnull/followers","following_url":"https://api.github.com/users/cloudnull/following{/other_user}","gists_url":"https://api.github.com/users/cloudnull/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudnull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudnull/subscriptions","organizations_url":"https://api.github.com/users/cloudnull/orgs","repos_url":"https://api.github.com/users/cloudnull/repos","events_url":"https://api.github.com/users/cloudnull/events{/privacy}","received_events_url":"https://api.github.com/users/cloudnull/received_events","type":"User","site_admin":false},"body":"This change is in response to issue #1497 where the apt module would not\r\nproperly updating the apt cache in some situations and never returned a state\r\nchange on cache update when the module was used without or without an item to\r\nbe installed or upgraded.\r\n\r\nThe change simply allows the apt module to update the cache when\r\n`update_cache` option is used without or without a set `cache_valid_time`. If\r\n`cache_valid_time` is set and the on disk mtime for apt cache is \">\" the\r\nprovided amount of seconds, which now has a default of 0, the apt cache will\r\nbe updated. Additionally if no upgrade, package, or deb is installed or\r\nchanged but the apt cache is updated the module will return a changed state\r\nwhich will help users to know that the state of the environment has changed\r\ndue to a task operation, even if it was only an apt cahce update.\r\n\r\nSigned-off By: Kevin Carter <kevin.carter@rackspace.com>","created_at":"2015-06-14T06:05:13Z","updated_at":"2015-07-04T21:20:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4451af35f5db05cfbbf8e77cec829d0af875f162","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ansible/ansible-modules-core/pulls/1517/commits","review_comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/pulls/1517/comments","review_comment_url":"https://api.github.com/repos/ansible/ansible-modules-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/1517/comments","statuses_url":"https://api.github.com/repos/ansible/ansible-modules-core/statuses/903c9265c781bf5445d0d0b599035bb456d919ef","head":{"label":"cloudnull:issue-1497","ref":"issue-1497","sha":"903c9265c781bf5445d0d0b599035bb456d919ef","user":{"login":"cloudnull","id":2066292,"avatar_url":"https://avatars.githubusercontent.com/u/2066292?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudnull","html_url":"https://github.com/cloudnull","followers_url":"https://api.github.com/users/cloudnull/followers","following_url":"https://api.github.com/users/cloudnull/following{/other_user}","gists_url":"https://api.github.com/users/cloudnull/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudnull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudnull/subscriptions","organizations_url":"https://api.github.com/users/cloudnull/orgs","repos_url":"https://api.github.com/users/cloudnull/repos","events_url":"https://api.github.com/users/cloudnull/events{/privacy}","received_events_url":"https://api.github.com/users/cloudnull/received_events","type":"User","site_admin":false},"repo":{"id":27153182,"name":"ansible-modules-core","full_name":"cloudnull/ansible-modules-core","owner":{"login":"cloudnull","id":2066292,"avatar_url":"https://avatars.githubusercontent.com/u/2066292?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudnull","html_url":"https://github.com/cloudnull","followers_url":"https://api.github.com/users/cloudnull/followers","following_url":"https://api.github.com/users/cloudnull/following{/other_user}","gists_url":"https://api.github.com/users/cloudnull/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudnull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudnull/subscriptions","organizations_url":"https://api.github.com/users/cloudnull/orgs","repos_url":"https://api.github.com/users/cloudnull/repos","events_url":"https://api.github.com/users/cloudnull/events{/privacy}","received_events_url":"https://api.github.com/users/cloudnull/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cloudnull/ansible-modules-core","description":"Ansible modules - these modules ship with ansible","fork":true,"url":"https://api.github.com/repos/cloudnull/ansible-modules-core","forks_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/forks","keys_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/teams","hooks_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/hooks","issue_events_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/issues/events{/number}","events_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/events","assignees_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/assignees{/user}","branches_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/branches{/branch}","tags_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/tags","blobs_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/languages","stargazers_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/stargazers","contributors_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/contributors","subscribers_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/subscribers","subscription_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/subscription","commits_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/contents/{+path}","compare_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/merges","archive_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/downloads","issues_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/issues{/number}","pulls_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/labels{/name}","releases_url":"https://api.github.com/repos/cloudnull/ansible-modules-core/releases{/id}","created_at":"2014-11-26T00:48:55Z","updated_at":"2014-11-26T00:48:55Z","pushed_at":"2015-06-17T02:42:37Z","git_url":"git://github.com/cloudnull/ansible-modules-core.git","ssh_url":"git@github.com:cloudnull/ansible-modules-core.git","clone_url":"https://github.com/cloudnull/ansible-modules-core.git","svn_url":"https://github.com/cloudnull/ansible-modules-core","homepage":"","size":6806,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"devel"}},"base":{"label":"ansible:devel","ref":"devel","sha":"351fca028fa98634c92aa44c32cd773350eda5d8","user":{"login":"ansible","id":1507452,"avatar_url":"https://avatars.githubusercontent.com/u/1507452?v=3","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"repo":{"id":24474126,"name":"ansible-modules-core","full_name":"ansible/ansible-modules-core","owner":{"login":"ansible","id":1507452,"avatar_url":"https://avatars.githubusercontent.com/u/1507452?v=3","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ansible/ansible-modules-core","description":"Ansible modules - these modules ship with ansible","fork":false,"url":"https://api.github.com/repos/ansible/ansible-modules-core","forks_url":"https://api.github.com/repos/ansible/ansible-modules-core/forks","keys_url":"https://api.github.com/repos/ansible/ansible-modules-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ansible/ansible-modules-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ansible/ansible-modules-core/teams","hooks_url":"https://api.github.com/repos/ansible/ansible-modules-core/hooks","issue_events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/events{/number}","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/events","assignees_url":"https://api.github.com/repos/ansible/ansible-modules-core/assignees{/user}","branches_url":"https://api.github.com/repos/ansible/ansible-modules-core/branches{/branch}","tags_url":"https://api.github.com/repos/ansible/ansible-modules-core/tags","blobs_url":"https://api.github.com/repos/ansible/ansible-modules-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ansible/ansible-modules-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ansible/ansible-modules-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/ansible/ansible-modules-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ansible/ansible-modules-core/statuses/{sha}","languages_url":"https://api.github.com/repos/ansible/ansible-modules-core/languages","stargazers_url":"https://api.github.com/repos/ansible/ansible-modules-core/stargazers","contributors_url":"https://api.github.com/repos/ansible/ansible-modules-core/contributors","subscribers_url":"https://api.github.com/repos/ansible/ansible-modules-core/subscribers","subscription_url":"https://api.github.com/repos/ansible/ansible-modules-core/subscription","commits_url":"https://api.github.com/repos/ansible/ansible-modules-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/ansible/ansible-modules-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/ansible/ansible-modules-core/contents/{+path}","compare_url":"https://api.github.com/repos/ansible/ansible-modules-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ansible/ansible-modules-core/merges","archive_url":"https://api.github.com/repos/ansible/ansible-modules-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ansible/ansible-modules-core/downloads","issues_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues{/number}","pulls_url":"https://api.github.com/repos/ansible/ansible-modules-core/pulls{/number}","milestones_url":"https://api.github.com/repos/ansible/ansible-modules-core/milestones{/number}","notifications_url":"https://api.github.com/repos/ansible/ansible-modules-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/labels{/name}","releases_url":"https://api.github.com/repos/ansible/ansible-modules-core/releases{/id}","created_at":"2014-09-25T20:28:25Z","updated_at":"2015-07-04T13:50:17Z","pushed_at":"2015-07-04T20:50:51Z","git_url":"git://github.com/ansible/ansible-modules-core.git","ssh_url":"git@github.com:ansible/ansible-modules-core.git","clone_url":"https://github.com/ansible/ansible-modules-core.git","svn_url":"https://github.com/ansible/ansible-modules-core","homepage":"","size":46744,"stargazers_count":350,"watchers_count":350,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":825,"mirror_url":null,"open_issues_count":572,"forks":825,"open_issues":572,"watchers":350,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible-modules-core/pulls/1517"},"html":{"href":"https://github.com/ansible/ansible-modules-core/pull/1517"},"issue":{"href":"https://api.github.com/repos/ansible/ansible-modules-core/issues/1517"},"comments":{"href":"https://api.github.com/repos/ansible/ansible-modules-core/issues/1517/comments"},"review_comments":{"href":"https://api.github.com/repos/ansible/ansible-modules-core/pulls/1517/comments"},"review_comment":{"href":"https://api.github.com/repos/ansible/ansible-modules-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ansible/ansible-modules-core/pulls/1517/commits"},"statuses":{"href":"https://api.github.com/repos/ansible/ansible-modules-core/statuses/903c9265c781bf5445d0d0b599035bb456d919ef"}}}}