{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/30112","labels_url":"https://api.github.com/repos/saltstack/salt/issues/30112/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/30112/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/30112/events","html_url":"https://github.com/saltstack/salt/pull/30112","id":124523124,"number":30112,"title":"Modify to return meaningful dictionary of available updates","user":{"login":"theherk","id":3605078,"avatar_url":"https://avatars.githubusercontent.com/u/3605078?v=3","gravatar_id":"","url":"https://api.github.com/users/theherk","html_url":"https://github.com/theherk","followers_url":"https://api.github.com/users/theherk/followers","following_url":"https://api.github.com/users/theherk/following{/other_user}","gists_url":"https://api.github.com/users/theherk/gists{/gist_id}","starred_url":"https://api.github.com/users/theherk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theherk/subscriptions","organizations_url":"https://api.github.com/users/theherk/orgs","repos_url":"https://api.github.com/users/theherk/repos","events_url":"https://api.github.com/users/theherk/events{/privacy}","received_events_url":"https://api.github.com/users/theherk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-01T00:56:47Z","updated_at":"2016-01-01T01:10:39Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/saltstack/salt/pulls/30112","html_url":"https://github.com/saltstack/salt/pull/30112","diff_url":"https://github.com/saltstack/salt/pull/30112.diff","patch_url":"https://github.com/saltstack/salt/pull/30112.patch"},"body":"Previously list_updates was returning a formatted string including\r\ntabs and newlines. This is no good for data consumtion and needed\r\nto be changed to tabular data. We can now return a proper object\r\nafter consuming specific fields from the COM. Previously, the only\r\nfield included in the formatted return was description. Several\r\nmore, though not all, have been added.\r\n\r\nThis also adds a field parameter with which you can specify fields\r\nfor return. This parameter is superceded by the verbose parameter.\r\n\r\nThe documentation on the function has been updated to reflect\r\nthese changes.\r\n\r\nThe references to Harry Potter (as much as it pains me to mention\r\nit) have been removed from the modified functions and methods.\r\nThe amount of those references in contrib was out of control. I'm\r\nglad to see it making its way out.\r\n\r\nLast, no changes have been made otherwise, so the download and\r\ninstallation should not be affected."},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/168271169","html_url":"https://github.com/saltstack/salt/pull/30112#issuecomment-168271169","issue_url":"https://api.github.com/repos/saltstack/salt/issues/30112","id":168271169,"user":{"login":"theherk","id":3605078,"avatar_url":"https://avatars.githubusercontent.com/u/3605078?v=3","gravatar_id":"","url":"https://api.github.com/users/theherk","html_url":"https://github.com/theherk","followers_url":"https://api.github.com/users/theherk/followers","following_url":"https://api.github.com/users/theherk/following{/other_user}","gists_url":"https://api.github.com/users/theherk/gists{/gist_id}","starred_url":"https://api.github.com/users/theherk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theherk/subscriptions","organizations_url":"https://api.github.com/users/theherk/orgs","repos_url":"https://api.github.com/users/theherk/repos","events_url":"https://api.github.com/users/theherk/events{/privacy}","received_events_url":"https://api.github.com/users/theherk/received_events","type":"User","site_admin":false},"created_at":"2016-01-01T01:10:39Z","updated_at":"2016-01-01T01:10:39Z","body":"This previously would return:\r\n\r\n```bash\r\npepper \"herk*\" --ignore-ssl-errors win_update.list_updates\r\n{\r\n    \"return\": [\r\n        {\r\n            \"herk-hume-outer\": \"There are 6 updates, by category there are:\\n\\tUpdates: 5\\n\\tWindows 8.1: 5\\n\\tDefinition Updates: 1\\n\\tWindows Defender: 1\\n\"\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\nor:\r\n\r\n```bash\r\npepper \"herk*\" --ignore-ssl-errors win_update.list_updates verbose=True\r\n{\r\n    \"return\": [\r\n        {\r\n            \"herk-hume-outer\": \"There are 6 updates. They are as follows:\\n\\tUpdate for Windows 8.1 for x64-based Systems (KB3013816)\\n\\tUpdate for Windows 8.1 for x64-based Systems (KB3013769)\\n\\tUpdate for Windows 8.1 for x64-based Systems (KB3058168)\\n\\tUpdate for Windows 8.1 for x64-based Systems (KB3072019)\\n\\tUpdate for Windows 8.1 for x64-based Systems (KB3084905)\\n\\tDefinition Update for Windows Defender - KB2267602 (Definition 1.213.1492.0)\\n\"\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\nYes, it printed prettier when returning in the default format:\r\n\r\n```bash\r\nsalt \"herk*\" win_update.list_updates verbose=True\r\nherk-hume-outer:\r\n    There are 6 updates. They are as follows:\r\n        Update for Windows 8.1 for x64-based Systems (KB3013816)\r\n        Update for Windows 8.1 for x64-based Systems (KB3013769)\r\n        Update for Windows 8.1 for x64-based Systems (KB3058168)\r\n        Update for Windows 8.1 for x64-based Systems (KB3072019)\r\n        Update for Windows 8.1 for x64-based Systems (KB3084905)\r\n        Definition Update for Windows Defender - KB2267602 (Definition 1.213.1492.0)\r\n```\r\n\r\nThat is beside the point. This is more useful as data than it is as a string. It now returns this:\r\n\r\n```bash\r\npepper \"herk*\" --ignore-ssl-errors win_update_new.list_updates verbose=True\r\n{\r\n    \"return\": [\r\n        {\r\n            \"herk-hume-outer\": [\r\n                {\r\n                    \"Categories\": [\r\n                        {\r\n                            \"Description\": \"A broadly released fix for a specific problem addressing a noncritical, non-security-related bug.\",\r\n                            \"Name\": \"Updates\"\r\n                        },\r\n                        {\r\n                            \"Description\": \"Windows 8.1\",\r\n                            \"Name\": \"Windows 8.1\"\r\n                        }\r\n                    ],\r\n                    \"Description\": \"Install this update to resolve issues in Windows. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article for more information. After you install this item, you may have to restart your computer.\",\r\n                    \"Identity\": {\r\n                        \"RevisionNumber\": 201,\r\n                        \"UpdateID\": \"51962451-2048-4523-b9f5-3e2965f278de\"\r\n                    },\r\n                    \"IsMandatory\": false,\r\n                    \"KBArticleIDs\": [\r\n                        \"3013816\"\r\n                    ],\r\n                    \"MaxDownloadSize\": \"5074388\",\r\n                    \"MinDownloadSize\": \"5074388\",\r\n                    \"MoreInfoUrls\": [\r\n                        \"http://support.microsoft.com/kb/3013816\"\r\n                    ],\r\n                    \"MsrcSeverity\": \"\",\r\n                    \"ReleaseNotes\": \"\",\r\n                    \"SecurityBulletinIDs\": [],\r\n                    \"SupportUrl\": \"http://support.microsoft.com\",\r\n                    \"Title\": \"Update for Windows 8.1 for x64-based Systems (KB3013816)\"\r\n                },\r\n                {\r\n                    \"Categories\": [\r\n                        {\r\n                            \"Description\": \"A broadly released fix for a specific problem addressing a noncritical, non-security-related bug.\",\r\n                            \"Name\": \"Updates\"\r\n                        },\r\n                        {\r\n                            \"Description\": \"Windows 8.1\",\r\n                            \"Name\": \"Windows 8.1\"\r\n                        }\r\n                    ],\r\n                    \"Description\": \"Install this update to resolve issues in Windows. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article for more information. After you install this item, you may have to restart your computer.\",\r\n                    \"Identity\": {\r\n                        \"RevisionNumber\": 209,\r\n                        \"UpdateID\": \"f80f971d-e079-4216-b686-bf5d4412376b\"\r\n                    },\r\n                    \"IsMandatory\": false,\r\n                    \"KBArticleIDs\": [\r\n                        \"3013769\"\r\n                    ],\r\n                    \"MaxDownloadSize\": \"58904256\",\r\n                    \"MinDownloadSize\": \"58515593\",\r\n                    \"MoreInfoUrls\": [\r\n                        \"http://support.microsoft.com/kb/3013769\"\r\n                    ],\r\n                    \"MsrcSeverity\": \"\",\r\n                    \"ReleaseNotes\": \"\",\r\n                    \"SecurityBulletinIDs\": [],\r\n                    \"SupportUrl\": \"http://support.microsoft.com\",\r\n                    \"Title\": \"Update for Windows 8.1 for x64-based Systems (KB3013769)\"\r\n                }\r\n            ]\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\nThat is truncated for brevity. Also, you can request specific fields, or just get the titles.\r\n\r\n```bash\r\npepper \"herk*\" --ignore-ssl-errors win_update_new.list_updates\r\n{\r\n    \"return\": [\r\n        {\r\n            \"herk-hume-outer\": [\r\n                \"Update for Windows 8.1 for x64-based Systems (KB3013816)\",\r\n                \"Update for Windows 8.1 for x64-based Systems (KB3013769)\",\r\n                \"Update for Windows 8.1 for x64-based Systems (KB3058168)\",\r\n                \"Update for Windows 8.1 for x64-based Systems (KB3072019)\",\r\n                \"Update for Windows 8.1 for x64-based Systems (KB3084905)\",\r\n                \"Definition Update for Windows Defender - KB2267602 (Definition 1.213.1492.0)\"\r\n            ]\r\n        }\r\n    ]\r\n}\r\n```"}}