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

[sigh] fix cache parameters validation #21766

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions match/lib/match/portal_cache.rb
Expand Up @@ -18,8 +18,8 @@ def self.build(params:, bundle_id_identifiers:)
profile_type: profile_type,
additional_cert_types: params[:additional_cert_types],
bundle_id_identifiers: bundle_id_identifiers,
needs_profiles_devices: ProfileIncludes.can_force_include?(params: params, notify: true) && !params[:force] && !params[:readonly],
needs_profiles_certificate_content: !ProfileIncludes.can_force_include_all_certificates?(params: params),
needs_profiles_devices: ProfileIncludes.can_force_include_all_devices?(params: params, notify: true),
needs_profiles_certificate_content: !ProfileIncludes.can_force_include_all_certificates?(params: params, notify: true),
include_mac_in_profiles: params[:include_mac_in_profiles]
)

Expand Down
4 changes: 2 additions & 2 deletions match/lib/match/profile_includes.rb
Expand Up @@ -46,7 +46,7 @@ def self.can_force_include_all_devices?(params:, notify: false)
def self.devices_differ?(portal_profile:, platform:, include_mac_in_profiles:, cached_devices:)
return false unless portal_profile

profile_devices = portal_profile.devices
profile_devices = portal_profile.devices || []

portal_devices = cached_devices
portal_devices ||= Match::Portal::Fetcher.devices(platform: platform, include_mac_in_profiles: include_mac_in_profiles)
Expand Down Expand Up @@ -102,7 +102,7 @@ def self.can_force_include_all_certificates?(params:, notify: false)
def self.certificates_differ?(portal_profile:, platform:, cached_certificates:)
return false unless portal_profile

profile_certs = portal_profile.certificates
profile_certs = portal_profile.certificates || []

portal_certs = cached_certificates
portal_certs ||= Match::Portal::Fetcher.certificates(platform: platform, profile_type: portal_profile.profile_type)
Expand Down
16 changes: 8 additions & 8 deletions sigh/lib/sigh/options.rb
Expand Up @@ -205,10 +205,10 @@ def self.available_options
is_string: false,
default_value: nil,
verify_block: proc do |value|
next if value.nil?
if !value.kind_of?(Array) ||
value.empty? ||
!value.all?(Spaceship::ConnectAPI::Certificate)
UI.user_error!("cached_certificates parameter must be a non-empty array of Spaceship::ConnectAPI::Certificate") unless value.kind_of?(Array)
UI.user_error!("cached_certificates parameter must be an array of Spaceship::ConnectAPI::Certificate") unless value.kind_of?(Array)
end
end),
FastlaneCore::ConfigItem.new(key: :cached_devices,
Expand All @@ -217,10 +217,10 @@ def self.available_options
is_string: false,
default_value: nil,
verify_block: proc do |value|
next if value.nil?
if !value.kind_of?(Array) ||
value.empty? ||
!value.all?(Spaceship::ConnectAPI::Device)
UI.user_error!("cached_devices parameter must be a non-empty array of Spaceship::ConnectAPI::Device")
UI.user_error!("cached_devices parameter must be an array of Spaceship::ConnectAPI::Device")
end
end),
FastlaneCore::ConfigItem.new(key: :cached_bundle_ids,
Expand All @@ -229,10 +229,10 @@ def self.available_options
is_string: false,
default_value: nil,
verify_block: proc do |value|
next if value.nil?
if !value.kind_of?(Array) ||
value.empty? ||
!value.all?(Spaceship::ConnectAPI::BundleId)
UI.user_error!("cached_bundle_ids parameter must be a non-empty array of Spaceship::ConnectAPI::BundleId")
UI.user_error!("cached_bundle_ids parameter must be an array of Spaceship::ConnectAPI::BundleId")
end
end),
FastlaneCore::ConfigItem.new(key: :cached_profiles,
Expand All @@ -241,10 +241,10 @@ def self.available_options
is_string: false,
default_value: nil,
verify_block: proc do |value|
next if value.nil?
if !value.kind_of?(Array) ||
value.empty? ||
!value.all?(Spaceship::ConnectAPI::Profile)
UI.user_error!("cached_profiles parameter must be a non-empty array of Spaceship::ConnectAPI::Profile")
UI.user_error!("cached_profiles parameter must be an array of Spaceship::ConnectAPI::Profile")
end
end)
]
Expand Down