Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring warnings in line with 2016 Apple branding #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions chef/cookbooks/uber_helpers/libraries/node_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def bionic?

def catalina?
unless macos?
Chef::Log.warn('node.catalina? called on non-OS X!')
Chef::Log.warn('node.catalina? called on non-macOS!')
return
end
return node.os_at_least?('10.15') && node.os_less_than?('10.16')
Expand Down Expand Up @@ -207,7 +207,7 @@ def delete_file(path_of_file)

def el_capitan?
unless macos?
Chef::Log.warn('node.el_capitan? called on non-OS X!')
Chef::Log.warn('node.el_capitan? called on non-macOS!')
return
end
return node.os_at_least?('10.11') && node.os_less_than?('10.12')
Expand Down Expand Up @@ -236,7 +236,7 @@ def greater_than?(version1, version2)

def high_sierra?
unless macos?
Chef::Log.warn('node.high_sierra? called on non-OS X!')
Chef::Log.warn('node.high_sierra? called on non-macOS!')
return
end
return node.os_at_least?('10.13') && node.os_less_than?('10.14')
Expand Down Expand Up @@ -297,7 +297,7 @@ def logged_on_user_registry

def macos_application_version(apppath, key)
unless macos?
Chef::Log.warn('node.macos_application_version called on non-OS X!')
Chef::Log.warn('node.macos_application_version called on non-macOS!')
return ''
end
if ::File.exist?(apppath)
Expand All @@ -313,7 +313,7 @@ def macos_application_version(apppath, key)

def macos_system_cert_installed?(cert_name)
unless macos?
Chef::Log.warn('node.macos_cert_installed? called on non-OS X!')
Chef::Log.warn('node.macos_cert_installed? called on non-macOS!')
return false
end
shell_out(
Expand All @@ -323,7 +323,7 @@ def macos_system_cert_installed?(cert_name)

def macos_system_cert_hash?(cert_name)
unless macos?
Chef::Log.warn('node.macos_cert_hash? called on non-OS X!')
Chef::Log.warn('node.macos_cert_hash? called on non-macOS!')
return ''
end
shell_out(
Expand All @@ -333,7 +333,7 @@ def macos_system_cert_hash?(cert_name)

def macos_package_installed?(pkg_identifier, pkg_version)
unless macos?
Chef::Log.warn('node.macos_package_installed? called on non-OS X!')
Chef::Log.warn('node.macos_package_installed? called on non-macOS!')
false
end
installed_pkg_version = shell_out(
Expand All @@ -349,7 +349,7 @@ def macos_package_installed?(pkg_identifier, pkg_version)

def macos_min_package_installed?(pkg_identifier, pkg_version)
unless macos?
Chef::Log.warn('node.macos_min_package_installed? called on non-OS X!')
Chef::Log.warn('node.macos_min_package_installed? called on non-macOS!')
false
end
installed_pkg_version = shell_out(
Expand All @@ -365,7 +365,7 @@ def macos_min_package_installed?(pkg_identifier, pkg_version)

def macos_package_present?(pkg_identifier)
unless macos?
Chef::Log.warn('node.macos_package_present? called on non-OS X!')
Chef::Log.warn('node.macos_package_present? called on non-macOS!')
return false
end
installed_pkg_version = shell_out(
Expand All @@ -380,7 +380,7 @@ def macos_package_present?(pkg_identifier)

def mojave?
unless macos?
Chef::Log.warn('node.mojave? called on non-OS X!')
Chef::Log.warn('node.mojave? called on non-macOS!')
return
end
return node.os_at_least?('10.14') && node.os_less_than?('10.15')
Expand Down Expand Up @@ -413,7 +413,7 @@ def profile_installed?(type, value, mdm = nil)

def sierra?
unless macos?
Chef::Log.warn('node.sierra? called on non-OS X!')
Chef::Log.warn('node.sierra? called on non-macOS!')
return
end
return node.os_at_least?('10.12') && node.os_less_than?('10.13')
Expand Down Expand Up @@ -513,7 +513,7 @@ def ws1_min_user_profile_installed?(display_name, version)

def yosemite?
unless macos?
Chef::Log.warn('node.yosemite? called on non-OS X!')
Chef::Log.warn('node.yosemite? called on non-macOS!')
return
end
return node.os_at_least?('10.10') && node.os_less_than?('10.11')
Expand Down Expand Up @@ -641,7 +641,7 @@ def macos_os_sub_version
@macos_os_sub_version ||=
begin
unless macos?
Chef::Log.warn('node.macos_os_sub_version called on non-OS X!')
Chef::Log.warn('node.macos_os_sub_version called on non-macOS!')
return '0'
end
cmd = shell_out('/usr/sbin/sysctl -n kern.osversion').run_command.stdout
Expand Down Expand Up @@ -741,7 +741,7 @@ def network_extension_enabled?(extension_identifier)
return extension_enabled
end
unless macos?
Chef::Log.warn('node.network_extension_enabled? called on non-OS X!')
Chef::Log.warn('node.network_extension_enabled? called on non-macOS!')
return extension_enabled
end
# Everything is in a key of "$objects"
Expand All @@ -767,7 +767,7 @@ def system_extension_installed?(extension_identifier)
return system_extension_installed
end
unless macos?
Chef::Log.warn('node.system_extension_installed? called on non-OS X!')
Chef::Log.warn('node.system_extension_installed? called on non-macOS!')
return system_extension_installed
end
CF::Preferences.get('extensions', '/Library/SystemExtensions/db.plist').each do |k, _v|
Expand All @@ -783,7 +783,7 @@ def system_extension_installed?(extension_identifier)
# nil value if the package is not installed.
def installed_pkg_version(pkg_identifier)
unless macos?
Chef::Log.warn('node.installed_pkg_version called on non-OS X!')
Chef::Log.warn('node.installed_pkg_version called on non-macOS!')
return nil
end
installed_pkg_version = shell_out(
Expand Down Expand Up @@ -860,7 +860,7 @@ def bplist?(file_path)
def nslookup_txt_records(domain, timeout = 3)
results = {}
unless macos?
Chef::Log.warn('node.nslookup called on non-OS X!')
Chef::Log.warn('node.nslookup called on non-macOS!')
return nil
end
records = shell_out(
Expand All @@ -885,23 +885,23 @@ def nslookup_txt_records(domain, timeout = 3)

def daemon_running?(daemon)
unless macos?
Chef::Log.warn('node.dameon_running? called on non-OS X!')
Chef::Log.warn('node.dameon_running? called on non-macOS!')
return nil
end
shell_out('/bin/launchctl list').run_command.stdout.to_s[/(.*)#{daemon}/].nil? ? false : true
end

def macos_boottime
unless macos?
Chef::Log.warn('node.macos_boottime called on non-OS X!')
Chef::Log.warn('node.macos_boottime called on non-macOS!')
return nil
end
shell_out('/usr/sbin/sysctl -n kern.boottime').run_command.stdout.to_s[/sec = (.*),/, 1].to_i
end

def macos_waketime
unless macos?
Chef::Log.warn('node.macos_boottime called on non-OS X!')
Chef::Log.warn('node.macos_boottime called on non-macOS!')
return nil
end
shell_out('/usr/sbin/sysctl -n kern.waketime').run_command.stdout.to_s[/sec = (.*),/, 1].to_i
Expand All @@ -910,7 +910,7 @@ def macos_waketime
def macos_process_uptime(process)
uptime = 0
unless macos?
Chef::Log.warn('node.macos_process_time called on non-OS X!')
Chef::Log.warn('node.macos_process_time called on non-macOS!')
return nil
end
time = shell_out('/bin/ps acxo etime,command').run_command.stdout.to_s[/(.*) #{process}/, 1]
Expand Down