From 9f82f3fd14a7fd3aa32b21cbe0eec6ed984ebd73 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Mon, 18 Feb 2019 04:22:44 -0600 Subject: [PATCH] Alias ansible_model to ansible_product_name for Darwin. Fixes #52233 (#52242) --- changelogs/fragments/mac-product-name.yaml | 3 +++ lib/ansible/module_utils/facts/hardware/darwin.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/mac-product-name.yaml diff --git a/changelogs/fragments/mac-product-name.yaml b/changelogs/fragments/mac-product-name.yaml new file mode 100644 index 00000000000..0f09d7f77f6 --- /dev/null +++ b/changelogs/fragments/mac-product-name.yaml @@ -0,0 +1,3 @@ +minor_changes: +- facts - Alias ``ansible_model`` to ``ansible_product_name`` to more closely match other OSes + (https://github.com/ansible/ansible/issues/52233) diff --git a/lib/ansible/module_utils/facts/hardware/darwin.py b/lib/ansible/module_utils/facts/hardware/darwin.py index f4664d50317..79d58cff4e8 100644 --- a/lib/ansible/module_utils/facts/hardware/darwin.py +++ b/lib/ansible/module_utils/facts/hardware/darwin.py @@ -64,7 +64,7 @@ class DarwinHardware(Hardware): mac_facts = {} rc, out, err = self.module.run_command("sysctl hw.model") if rc == 0: - mac_facts['model'] = out.splitlines()[-1].split()[1] + mac_facts['model'] = mac_facts['product_name'] = out.splitlines()[-1].split()[1] mac_facts['osversion'] = self.sysctl['kern.osversion'] mac_facts['osrevision'] = self.sysctl['kern.osrevision']