summaryrefslogtreecommitdiffstats
path: root/test/units
diff options
context:
space:
mode:
authorAbhijeet Kasurde <akasurde@redhat.com>2021-03-18 06:53:01 +0100
committerMatt Clay <matt@mystile.com>2021-03-18 20:42:04 +0100
commit3811fddede11f5493e6de8136a6acdd1232d32f3 (patch)
tree75db867c51b465d9770d32fa9ec76f0a11533823 /test/units
parentRemove ini and env fields for config option CONNECTION_FACTS_MODULES (diff)
downloadansible-3811fddede11f5493e6de8136a6acdd1232d32f3.tar.xz
ansible-3811fddede11f5493e6de8136a6acdd1232d32f3.zip
Amazon: Fix distribution facts for older release
Ansible can gather distribution facts for older Amazon Linux with /etc/os-release data. Fixes: #73946 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Diffstat (limited to 'test/units')
-rw-r--r--test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2.json27
-rw-r--r--test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_release_2.json34
2 files changed, 50 insertions, 11 deletions
diff --git a/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2.json b/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2.json
index 9fa609068c..d98070ea0f 100644
--- a/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2.json
+++ b/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2.json
@@ -1,14 +1,14 @@
{
"platform.dist": [
- "",
- "",
+ "amzn",
+ "2",
""
],
"input": {
- "/etc/system-release": "Amazon Linux release 2",
- "/etc/os-release": ""
+ "/etc/os-release": "NAME=\"Amazon Linux\"\nVERSION=\"2\"\nID=\"amzn\"\nID_LIKE=\"centos rhel fedora\"\nVERSION_ID=\"2\"\nPRETTY_NAME=\"Amazon Linux 2\"\nANSI_COLOR=\"0;33\"\nCPE_NAME=\"cpe:2.3:o:amazon:amazon_linux:2\"\nHOME_URL=\"https://amazonlinux.com/\"\n",
+ "/etc/system-release": "Amazon Linux release 2 (Karoo)\n"
},
- "name": "Amazon Linux 2",
+ "name": "Amazon 2",
"result": {
"distribution_release": "NA",
"distribution": "Amazon",
@@ -18,17 +18,22 @@
},
"distro": {
"id": "amzn",
+ "name": "Amazon Linux",
"version": "2",
"codename": "",
+ "version_best": "2",
+ "lsb_release_info": {},
"os_release_info": {
- "name": "Amazon Linux AMI",
"ansi_color": "0;33",
- "id_like": "rhel fedora",
+ "id_like": "centos rhel fedora",
"version_id": "2",
- "pretty_name": "Amazon Linux release 2",
+ "pretty_name": "Amazon Linux 2",
+ "name": "Amazon Linux",
"version": "2",
- "home_url": "",
- "id": "amzn"
+ "home_url": "https://amazonlinux.com/",
+ "id": "amzn",
+ "cpe_name": "cpe:2.3:o:amazon:amazon_linux:2"
}
- }
+ },
+ "platform.release": "4.14.181-142.260.amzn2.x86_64"
} \ No newline at end of file
diff --git a/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_release_2.json b/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_release_2.json
new file mode 100644
index 0000000000..9fa609068c
--- /dev/null
+++ b/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_release_2.json
@@ -0,0 +1,34 @@
+{
+ "platform.dist": [
+ "",
+ "",
+ ""
+ ],
+ "input": {
+ "/etc/system-release": "Amazon Linux release 2",
+ "/etc/os-release": ""
+ },
+ "name": "Amazon Linux 2",
+ "result": {
+ "distribution_release": "NA",
+ "distribution": "Amazon",
+ "distribution_major_version": "2",
+ "os_family": "RedHat",
+ "distribution_version": "2"
+ },
+ "distro": {
+ "id": "amzn",
+ "version": "2",
+ "codename": "",
+ "os_release_info": {
+ "name": "Amazon Linux AMI",
+ "ansi_color": "0;33",
+ "id_like": "rhel fedora",
+ "version_id": "2",
+ "pretty_name": "Amazon Linux release 2",
+ "version": "2",
+ "home_url": "",
+ "id": "amzn"
+ }
+ }
+} \ No newline at end of file