summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Ray <github@mattray.dev>2020-05-20 13:04:29 +1000
committerMatt Ray <github@mattray.dev>2020-05-20 13:04:29 +1000
commit6266214c2695fd13302e33b00d2c07023b2f9fdf (patch)
tree9449322b9fde47922eb156a9da4290020946af6a
parent6e73617243baa21815258f9b51352e9f3753af1d (diff)
downloadchef-6266214c2695fd13302e33b00d2c07023b2f9fdf.tar.gz
Added armv6l and armv7l to arm? and armhf? helpers
armv6l is Raspberry Pi 1/Zero armv7l is Raspberry Pi 2,3,4 Tested with Raspbian 10, Debian 10, Centos 7 Signed-off-by: Matt Ray <github@mattray.dev>
-rw-r--r--chef-utils/lib/chef-utils/dsl/architecture.rb6
-rw-r--r--chef-utils/spec/unit/dsl/architecture_spec.rb11
2 files changed, 14 insertions, 3 deletions
diff --git a/chef-utils/lib/chef-utils/dsl/architecture.rb b/chef-utils/lib/chef-utils/dsl/architecture.rb
index e78e80f416..1d1cd643b7 100644
--- a/chef-utils/lib/chef-utils/dsl/architecture.rb
+++ b/chef-utils/lib/chef-utils/dsl/architecture.rb
@@ -110,17 +110,17 @@ module ChefUtils
# @return [Boolean]
#
def arm?(node = __getnode)
- %w{armhf aarch64 arm64 arch64}.include?(node["kernel"]["machine"])
+ %w{armv6l armv7l armhf aarch64 arm64 arch64}.include?(node["kernel"]["machine"])
end
- # Determine if the current architecture is 32-bit ARM.
+ # Determine if the current architecture is 32-bit ARM hard float.
#
# @since 15.5
#
# @return [Boolean]
#
def armhf?(node = __getnode)
- %w{armhf}.include?(node["kernel"]["machine"])
+ %w{armv6l armv7l armhf}.include?(node["kernel"]["machine"])
end
# Determine if the current architecture is s390x.
diff --git a/chef-utils/spec/unit/dsl/architecture_spec.rb b/chef-utils/spec/unit/dsl/architecture_spec.rb
index 18045935a1..0334b08835 100644
--- a/chef-utils/spec/unit/dsl/architecture_spec.rb
+++ b/chef-utils/spec/unit/dsl/architecture_spec.rb
@@ -131,6 +131,17 @@ RSpec.describe ChefUtils::DSL::Architecture do
arch_reports_true_for(:armhf?, :_32_bit?, :arm?)
end
+ context "on armv6l" do
+ let(:arch) { "armhf" }
+
+ arch_reports_true_for(:armhf?, :_32_bit?, :arm?)
+ end
+ context "on armv7l" do
+ let(:arch) { "armhf" }
+
+ arch_reports_true_for(:armhf?, :_32_bit?, :arm?)
+ end
+
context "on s390" do
let(:arch) { "s390" }