chef 17.0.242-universal-mingw32 → 17.4.25-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -14
- data/Rakefile +2 -2
- data/chef.gemspec +10 -20
- data/lib/chef/action_collection.rb +6 -26
- data/lib/chef/application/base.rb +15 -0
- data/lib/chef/application.rb +4 -2
- data/lib/chef/chef_fs/file_pattern.rb +2 -2
- data/lib/chef/client.rb +7 -1
- data/lib/chef/compliance/default_attributes.rb +5 -3
- data/lib/chef/compliance/reporter/automate.rb +1 -1
- data/lib/chef/compliance/runner.rb +17 -3
- data/lib/chef/cookbook/cookbook_version_loader.rb +3 -3
- data/lib/chef/cookbook/gem_installer.rb +5 -1
- data/lib/chef/cookbook_version.rb +26 -4
- data/lib/chef/data_collector/run_end_message.rb +1 -1
- data/lib/chef/data_collector.rb +0 -1
- data/lib/chef/deprecated.rb +14 -4
- data/lib/chef/dsl/declare_resource.rb +5 -10
- data/lib/chef/dsl/render_helpers.rb +44 -0
- data/lib/chef/dsl/secret.rb +64 -0
- data/lib/chef/dsl/toml.rb +116 -0
- data/lib/chef/dsl/universal.rb +5 -0
- data/lib/chef/dsl.rb +1 -0
- data/lib/chef/event_dispatch/base.rb +2 -1
- data/lib/chef/exceptions.rb +23 -0
- data/lib/chef/formatters/doc.rb +2 -1
- data/lib/chef/formatters/error_mapper.rb +2 -2
- data/lib/chef/handler/slow_report.rb +66 -0
- data/lib/chef/handler.rb +46 -8
- data/lib/chef/json_compat.rb +1 -1
- data/lib/chef/node.rb +21 -20
- data/lib/chef/policy_builder/policyfile.rb +88 -45
- data/lib/chef/provider/directory.rb +6 -6
- data/lib/chef/provider/execute.rb +1 -1
- data/lib/chef/provider/file.rb +2 -2
- data/lib/chef/provider/group/dscl.rb +1 -1
- data/lib/chef/provider/launchd.rb +6 -6
- data/lib/chef/provider/link.rb +1 -1
- data/lib/chef/provider/lwrp_base.rb +1 -1
- data/lib/chef/provider/package/dnf/dnf_helper.py +11 -10
- data/lib/chef/provider/package/dnf/python_helper.rb +9 -8
- data/lib/chef/provider/package/habitat.rb +168 -0
- data/lib/chef/provider/package/powershell.rb +5 -0
- data/lib/chef/provider/package/yum/python_helper.rb +15 -10
- data/lib/chef/provider/package/yum/yum_helper.py +46 -62
- data/lib/chef/provider/package/yum.rb +1 -4
- data/lib/chef/provider/registry_key.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +1 -1
- data/lib/chef/provider/subversion.rb +4 -4
- data/lib/chef/provider/support/yum_repo.erb +1 -1
- data/lib/chef/provider/support/zypper_repo.erb +4 -2
- data/lib/chef/provider/systemd_unit.rb +18 -17
- data/lib/chef/provider/template/content.rb +1 -1
- data/lib/chef/provider/user/mac.rb +3 -3
- data/lib/chef/provider/windows_script.rb +1 -1
- data/lib/chef/provider/yum_repository.rb +27 -43
- data/lib/chef/provider/zypper_repository.rb +30 -34
- data/lib/chef/provider.rb +26 -1
- data/lib/chef/provider_resolver.rb +8 -2
- data/lib/chef/providers.rb +1 -0
- data/lib/chef/resource/alternatives.rb +5 -5
- data/lib/chef/resource/apt_preference.rb +2 -2
- data/lib/chef/resource/apt_repository.rb +2 -2
- data/lib/chef/resource/apt_update.rb +4 -4
- data/lib/chef/resource/build_essential.rb +1 -1
- data/lib/chef/resource/chef_client_config.rb +10 -5
- data/lib/chef/resource/chef_client_cron.rb +3 -3
- data/lib/chef/resource/chef_client_launchd.rb +3 -3
- data/lib/chef/resource/chef_client_scheduled_task.rb +15 -15
- data/lib/chef/resource/chef_client_systemd_timer.rb +3 -3
- data/lib/chef/resource/chef_client_trusted_certificate.rb +2 -2
- data/lib/chef/resource/chef_handler.rb +2 -2
- data/lib/chef/resource/chef_sleep.rb +1 -1
- data/lib/chef/resource/chef_vault_secret.rb +2 -2
- data/lib/chef/resource/chocolatey_feature.rb +2 -2
- data/lib/chef/resource/chocolatey_source.rb +1 -1
- data/lib/chef/resource/cron/cron_d.rb +4 -6
- data/lib/chef/resource/cron_access.rb +1 -1
- data/lib/chef/resource/dmg_package.rb +1 -1
- data/lib/chef/resource/dsc_resource.rb +1 -1
- data/lib/chef/resource/execute.rb +5 -5
- data/lib/chef/resource/gem_package.rb +2 -1
- data/lib/chef/resource/group.rb +4 -4
- data/lib/chef/resource/habitat/_habitat_shared.rb +28 -0
- data/lib/chef/resource/habitat/habitat_package.rb +129 -0
- data/lib/chef/resource/habitat/habitat_sup.rb +329 -0
- data/lib/chef/resource/habitat/habitat_sup_systemd.rb +67 -0
- data/lib/chef/resource/habitat/habitat_sup_windows.rb +90 -0
- data/lib/chef/resource/habitat_config.rb +107 -0
- data/lib/chef/resource/habitat_install.rb +247 -0
- data/lib/chef/resource/habitat_service.rb +451 -0
- data/lib/chef/resource/habitat_user_toml.rb +92 -0
- data/lib/chef/resource/homebrew_cask.rb +18 -7
- data/lib/chef/resource/homebrew_package.rb +1 -1
- data/lib/chef/resource/homebrew_tap.rb +4 -3
- data/lib/chef/resource/homebrew_update.rb +2 -2
- data/lib/chef/resource/hostname.rb +49 -7
- data/lib/chef/resource/inspec_waiver_file_entry.rb +156 -0
- data/lib/chef/resource/kernel_module.rb +6 -6
- data/lib/chef/resource/launchd.rb +3 -3
- data/lib/chef/resource/locale.rb +1 -1
- data/lib/chef/resource/lwrp_base.rb +18 -3
- data/lib/chef/resource/macos_userdefaults.rb +2 -2
- data/lib/chef/resource/ohai_hint.rb +2 -6
- data/lib/chef/resource/openbsd_package.rb +17 -0
- data/lib/chef/resource/openssl_dhparam.rb +1 -2
- data/lib/chef/resource/openssl_ec_private_key.rb +1 -3
- data/lib/chef/resource/openssl_ec_public_key.rb +1 -3
- data/lib/chef/resource/openssl_rsa_private_key.rb +1 -3
- data/lib/chef/resource/openssl_rsa_public_key.rb +1 -3
- data/lib/chef/resource/openssl_x509_certificate.rb +1 -4
- data/lib/chef/resource/openssl_x509_crl.rb +1 -3
- data/lib/chef/resource/openssl_x509_request.rb +1 -3
- data/lib/chef/resource/osx_profile.rb +3 -3
- data/lib/chef/resource/plist.rb +1 -1
- data/lib/chef/resource/powershell_package_source.rb +2 -4
- data/lib/chef/resource/reboot.rb +38 -9
- data/lib/chef/resource/remote_directory.rb +2 -2
- data/lib/chef/resource/remote_file.rb +3 -3
- data/lib/chef/resource/rhsm_errata.rb +0 -2
- data/lib/chef/resource/rhsm_errata_level.rb +1 -5
- data/lib/chef/resource/rhsm_repo.rb +15 -0
- data/lib/chef/resource/rhsm_subscription.rb +5 -5
- data/lib/chef/resource/ruby_block.rb +100 -0
- data/lib/chef/resource/scm/subversion.rb +1 -1
- data/lib/chef/resource/ssh_known_hosts_entry.rb +4 -7
- data/lib/chef/resource/sudo.rb +2 -6
- data/lib/chef/resource/support/HabService.dll.config.erb +19 -0
- data/lib/chef/resource/support/client.erb +8 -1
- data/lib/chef/resource/support/sup.toml.erb +179 -0
- data/lib/chef/resource/swap_file.rb +2 -6
- data/lib/chef/resource/sysctl.rb +2 -2
- data/lib/chef/resource/systemd_unit.rb +3 -3
- data/lib/chef/resource/timezone.rb +1 -1
- data/lib/chef/resource/user_ulimit.rb +2 -2
- data/lib/chef/resource/windows_ad_join.rb +2 -2
- data/lib/chef/resource/windows_audit_policy.rb +2 -2
- data/lib/chef/resource/windows_auto_run.rb +2 -2
- data/lib/chef/resource/windows_certificate.rb +1 -1
- data/lib/chef/resource/windows_defender.rb +163 -0
- data/lib/chef/resource/windows_defender_exclusion.rb +125 -0
- data/lib/chef/resource/windows_dfs_folder.rb +2 -2
- data/lib/chef/resource/windows_dfs_namespace.rb +2 -2
- data/lib/chef/resource/windows_dns_record.rb +2 -2
- data/lib/chef/resource/windows_dns_zone.rb +2 -2
- data/lib/chef/resource/windows_env.rb +1 -1
- data/lib/chef/resource/windows_feature.rb +3 -3
- data/lib/chef/resource/windows_feature_dism.rb +3 -5
- data/lib/chef/resource/windows_feature_powershell.rb +3 -3
- data/lib/chef/resource/windows_firewall_profile.rb +2 -2
- data/lib/chef/resource/windows_firewall_rule.rb +20 -6
- data/lib/chef/resource/windows_font.rb +2 -2
- data/lib/chef/resource/windows_pagefile.rb +104 -65
- data/lib/chef/resource/windows_path.rb +4 -4
- data/lib/chef/resource/windows_printer.rb +80 -61
- data/lib/chef/resource/windows_printer_port.rb +48 -65
- data/lib/chef/resource/windows_security_policy.rb +7 -4
- data/lib/chef/resource/windows_share.rb +2 -2
- data/lib/chef/resource/windows_shortcut.rb +1 -1
- data/lib/chef/resource/windows_task.rb +2 -2
- data/lib/chef/resource/windows_uac.rb +3 -5
- data/lib/chef/resource/windows_update_settings.rb +259 -0
- data/lib/chef/resource/windows_user_privilege.rb +2 -2
- data/lib/chef/resource/windows_workgroup.rb +2 -2
- data/lib/chef/resource/yum_package.rb +11 -15
- data/lib/chef/resource/zypper_package.rb +4 -4
- data/lib/chef/resource/zypper_repository.rb +28 -8
- data/lib/chef/resource.rb +20 -25
- data/lib/chef/resource_builder.rb +8 -2
- data/lib/chef/resource_inspector.rb +6 -2
- data/lib/chef/resource_reporter.rb +0 -1
- data/lib/chef/resources.rb +13 -1
- data/lib/chef/run_lock.rb +1 -1
- data/lib/chef/runner.rb +1 -1
- data/lib/chef/secret_fetcher/aws_secrets_manager.rb +65 -0
- data/lib/chef/secret_fetcher/azure_key_vault.rb +78 -0
- data/lib/chef/secret_fetcher/base.rb +76 -0
- data/lib/chef/secret_fetcher/example.rb +46 -0
- data/lib/chef/secret_fetcher.rb +55 -0
- data/lib/chef/shell/ext.rb +3 -3
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/api.rb +9 -2
- data/spec/data/knife-home/.chef/plugins/knife/example_home_subcommand.rb +0 -0
- data/spec/data/knife-site-subcommands/plugins/knife/example_subcommand.rb +0 -0
- data/spec/data/knife_subcommand/test_explicit_category.rb +7 -0
- data/spec/data/knife_subcommand/test_name_mapping.rb +4 -0
- data/spec/data/knife_subcommand/test_yourself.rb +21 -0
- data/spec/functional/mixin/from_file_spec.rb +1 -1
- data/spec/functional/resource/dnf_package_spec.rb +857 -537
- data/spec/functional/resource/group_spec.rb +1 -1
- data/spec/functional/resource/link_spec.rb +1 -1
- data/spec/functional/resource/remote_file_spec.rb +1 -1
- data/spec/functional/resource/windows_env_spec.rb +2 -2
- data/spec/functional/resource/windows_hostname_spec.rb +91 -0
- data/spec/functional/resource/windows_pagefile_spec.rb +98 -0
- data/spec/functional/resource/yum_package_spec.rb +495 -428
- data/spec/integration/client/client_spec.rb +0 -20
- data/spec/integration/compliance/compliance_spec.rb +1 -0
- data/spec/integration/recipes/recipe_dsl_spec.rb +1 -1
- data/spec/integration/recipes/resource_action_spec.rb +6 -6
- data/spec/integration/recipes/unified_mode_spec.rb +70 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/support/chef_helpers.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +1 -1
- data/spec/support/shared/functional/knife.rb +37 -0
- data/spec/support/shared/integration/knife_support.rb +192 -0
- data/spec/support/shared/unit/knife_shared.rb +39 -0
- data/spec/support/shared/unit/provider/file.rb +3 -9
- data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +1 -1
- data/spec/unit/compliance/runner_spec.rb +46 -2
- data/spec/unit/cookbook_version_spec.rb +52 -0
- data/spec/unit/data_collector_spec.rb +47 -1
- data/spec/unit/dsl/render_helpers_spec.rb +102 -0
- data/spec/unit/dsl/secret_spec.rb +71 -0
- data/spec/unit/handler_spec.rb +8 -2
- data/spec/unit/policy_builder/dynamic_spec.rb +0 -5
- data/spec/unit/policy_builder/policyfile_spec.rb +144 -56
- data/spec/unit/provider/apt_update_spec.rb +3 -1
- data/spec/unit/provider/link_spec.rb +1 -1
- data/spec/unit/provider/mount/aix_spec.rb +1 -1
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +1 -0
- data/spec/unit/provider/package/powershell_spec.rb +74 -12
- data/spec/unit/provider/package/yum/python_helper_spec.rb +1 -0
- data/spec/unit/provider/service/systemd_service_spec.rb +2 -2
- data/spec/unit/provider/systemd_unit_spec.rb +2 -2
- data/spec/unit/provider/zypper_repository_spec.rb +3 -10
- data/spec/unit/provider_spec.rb +23 -0
- data/spec/unit/resource/homebrew_cask_spec.rb +29 -11
- data/spec/unit/resource/inspec_waiver_file_entry_spec.rb +80 -0
- data/spec/unit/resource/rhsm_subscription_spec.rb +50 -3
- data/spec/unit/resource/systemd_unit_spec.rb +1 -1
- data/spec/unit/resource/windows_defender_exclusion_spec.rb +62 -0
- data/spec/unit/resource/windows_defender_spec.rb +71 -0
- data/spec/unit/resource/windows_firewall_rule_spec.rb +12 -7
- data/spec/unit/resource/windows_pagefile_spec.rb +4 -9
- data/spec/unit/resource/windows_update_settings_spec.rb +64 -0
- data/spec/unit/resource/zypper_repository_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +19 -8
- data/spec/unit/secret_fetcher/aws_secrets_manager_spec.rb +70 -0
- data/spec/unit/secret_fetcher/azure_key_vault_spec.rb +70 -0
- data/spec/unit/secret_fetcher_spec.rb +82 -0
- data/tasks/rspec.rb +4 -9
- metadata +65 -161
- data/lib/chef/provider/package/yum/simplejson/LICENSE.txt +0 -79
- data/lib/chef/provider/package/yum/simplejson/__init__.py +0 -318
- data/lib/chef/provider/package/yum/simplejson/__init__.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/decoder.py +0 -354
- data/lib/chef/provider/package/yum/simplejson/decoder.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/encoder.py +0 -440
- data/lib/chef/provider/package/yum/simplejson/encoder.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/scanner.py +0 -65
- data/lib/chef/provider/package/yum/simplejson/scanner.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/tool.py +0 -37
@@ -0,0 +1,65 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Marc Paradise (<marc@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require_relative "base"
|
20
|
+
require "aws-sdk-core"
|
21
|
+
require "aws-sdk-secretsmanager"
|
22
|
+
|
23
|
+
class Chef
|
24
|
+
# == Chef::SecretFetcher::AWSSecretsManager
|
25
|
+
# A fetcher that fetches a secret from AWS Secrets Manager
|
26
|
+
# In this initial iteration it defaults to authentication via instance profile.
|
27
|
+
# It is possible to pass options that configure it to use alternative credentials.
|
28
|
+
# This implementation supports fetching with version.
|
29
|
+
#
|
30
|
+
# @note ':region' is required configuration. If it is not explicitly provided,
|
31
|
+
# and it is not available via global AWS config, we will pull it from node ohai data by default.
|
32
|
+
# If this isn't correct, you will need to explicitly override it.
|
33
|
+
# If it is not available via ohai data either (such as if you have the AWS plugin disabled)
|
34
|
+
# then the converge will fail with an error.
|
35
|
+
#
|
36
|
+
# @note: This does not yet support automatic retries, which the AWS client does by default.
|
37
|
+
#
|
38
|
+
# For configuration options see https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SecretsManager/Client.html#initialize-instance_method
|
39
|
+
#
|
40
|
+
#
|
41
|
+
# Usage Example:
|
42
|
+
#
|
43
|
+
# fetcher = SecretFetcher.for_service(:aws_secrets_manager)
|
44
|
+
# fetcher.fetch("secretkey1", "v1")
|
45
|
+
class SecretFetcher
|
46
|
+
class AWSSecretsManager < Base
|
47
|
+
def validate!
|
48
|
+
config[:region] = config[:region] || Aws.config[:region] || run_context.node.dig("ec2", "region")
|
49
|
+
if config[:region].nil?
|
50
|
+
raise Chef::Exceptions::Secret::ConfigurationInvalid.new("Missing required config for AWS secret fetcher: :region")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# @param identifier [String] the secret_id
|
55
|
+
# @param version [String] the secret version. Not usd at this time
|
56
|
+
# @return Aws::SecretsManager::Types::GetSecretValueResponse
|
57
|
+
def do_fetch(identifier, version)
|
58
|
+
client = Aws::SecretsManager::Client.new(config)
|
59
|
+
result = client.get_secret_value(secret_id: identifier, version_stage: version)
|
60
|
+
# These fields are mutually exclusive
|
61
|
+
result.secret_string || result.secret_binary
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require_relative "base"
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class SecretFetcher
|
5
|
+
# == Chef::SecretFetcher::AWSSecretsManager
|
6
|
+
# A fetcher that fetches a secret from Azure Key Vault. Supports fetching with version.
|
7
|
+
#
|
8
|
+
# In this initial iteration this authenticates via token obtained from the OAuth2 /token
|
9
|
+
# endpoint.
|
10
|
+
#
|
11
|
+
# Validation of required configuration (vault name) is not performed until
|
12
|
+
# `fetch` time, to allow for embedding the vault name in with the secret
|
13
|
+
# name, such as "my_vault/secretkey1".
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
#
|
17
|
+
# fetcher = SecretFetcher.for_service(:azure_key_vault, { vault: "my_vault" }, run_context )
|
18
|
+
# fetcher.fetch("secretkey1", "v1")
|
19
|
+
#
|
20
|
+
# @example
|
21
|
+
#
|
22
|
+
# fetcher = SecretFetcher.for_service(:azure_key_vault, {}, run_context )
|
23
|
+
# fetcher.fetch("my_vault/secretkey1", "v1")
|
24
|
+
class AzureKeyVault < Base
|
25
|
+
|
26
|
+
def do_fetch(name, version)
|
27
|
+
token = fetch_token
|
28
|
+
vault, name = resolve_vault_and_secret_name(name)
|
29
|
+
if vault.nil?
|
30
|
+
raise Chef::Exceptions::Secret::ConfigurationInvalid.new("You must provide a vault name to fetcher options as vault: 'vault_name' or in the secret name as 'vault_name/secret_name'")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Note that `version` is optional after the final `/`. If nil/"", the latest secret version will be fetched.
|
34
|
+
secret_uri = URI.parse("https://#{vault}.vault.azure.net/secrets/#{name}/#{version}?api-version=7.2")
|
35
|
+
http = Net::HTTP.new(secret_uri.host, secret_uri.port)
|
36
|
+
http.use_ssl = true
|
37
|
+
|
38
|
+
response = http.get(secret_uri, { "Authorization" => "Bearer #{token}",
|
39
|
+
"Content-Type" => "application/json" })
|
40
|
+
|
41
|
+
# If an exception is not raised, we can be reasonably confident of the
|
42
|
+
# shape of the result.
|
43
|
+
result = JSON.parse(response.body)
|
44
|
+
if result.key? "value"
|
45
|
+
result["value"]
|
46
|
+
else
|
47
|
+
raise Chef::Exceptions::Secret::FetchFailed.new("#{result["error"]["code"]}: #{result["error"]["message"]}")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Determine the vault name and secret name from the provided name.
|
52
|
+
# If it is not in the provided name in the form "vault_name/secret_name"
|
53
|
+
# it will determine the vault name from `config[:vault]`.
|
54
|
+
# @param name [String] the secret name or vault and secret name in the form "vault_name/secret_name"
|
55
|
+
# @return Array[String, String] vault and secret name respectively
|
56
|
+
def resolve_vault_and_secret_name(name)
|
57
|
+
# We support a simplified approach where the vault name is not passed i
|
58
|
+
# into configuration, but
|
59
|
+
if name.include?("/")
|
60
|
+
name.split("/", 2)
|
61
|
+
else
|
62
|
+
[config[:vault], name]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def fetch_token
|
67
|
+
token_uri = URI.parse("http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fvault.azure.net")
|
68
|
+
http = Net::HTTP.new(token_uri.host, token_uri.port)
|
69
|
+
response = http.get(token_uri, { "Metadata" => "true" })
|
70
|
+
body = JSON.parse(response.body)
|
71
|
+
body["access_token"]
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Marc Paradise (<marc@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require_relative "../exceptions"
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
# == Chef::SecretFetcher
|
23
|
+
# An abstract base class that defines the methods required to implement
|
24
|
+
# a Secret Fetcher.
|
25
|
+
class SecretFetcher
|
26
|
+
class Base
|
27
|
+
attr_reader :config
|
28
|
+
# Note that this is only available in the context of a recipe.
|
29
|
+
# Since that's the only place it's intended to be used, that's probably OK.
|
30
|
+
attr_reader :run_context
|
31
|
+
|
32
|
+
# Initialize a new SecretFetcher::Base
|
33
|
+
#
|
34
|
+
# @param config [Hash] Configuration hash. Expected configuration keys and values
|
35
|
+
# will vary based on implementation, and are validated in `validate!`.
|
36
|
+
def initialize(config, run_context)
|
37
|
+
@config = config
|
38
|
+
@run_context = run_context
|
39
|
+
end
|
40
|
+
|
41
|
+
# Fetch the named secret by invoking implementation-specific [Chef::SecretFetcher::Base#do_fetch]
|
42
|
+
#
|
43
|
+
# @param name [Object] the name or identifier of the secret.
|
44
|
+
# @param version [Object] Optional version of the secret to fetch.
|
45
|
+
# @note - the name parameter will probably see a narrowing of type as we learn more about different integrations.
|
46
|
+
# @return [Object] the fetched secret
|
47
|
+
# @raise [Chef::Exceptions::Secret::MissingSecretName] when secret name is not provided
|
48
|
+
# @raise [Chef::Exceptions::Secret::FetchFailed] when the underlying attempt to fetch the secret fails.
|
49
|
+
def fetch(name, version = nil)
|
50
|
+
raise Chef::Exceptions::Secret::MissingSecretName.new if name.to_s == ""
|
51
|
+
|
52
|
+
do_fetch(name, version)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Validate that the instance is correctly configured.
|
56
|
+
# @raise [Chef::Exceptions::Secret::ConfigurationInvalid] if it is not.
|
57
|
+
def validate!; end
|
58
|
+
|
59
|
+
# Called to fetch the secret identified by 'identifer'. Implementations
|
60
|
+
# should expect that `validate!` has been invoked before `do_fetch`.
|
61
|
+
#
|
62
|
+
# @param identifier [Object] Unique identifier of the secret to be retrieved.
|
63
|
+
# When invoked via DSL, this is pre-verified to be not nil/not empty string.
|
64
|
+
# The expected data type and form can vary by implementation.
|
65
|
+
# @param version [Object] Optional version of the secret to be retrieved. If not
|
66
|
+
# provided, implementations are expected to fetch the most recent version of the
|
67
|
+
# secret by default.
|
68
|
+
#
|
69
|
+
# @return [Object] The secret as returned from the implementation. The data type
|
70
|
+
# will vary implementation.
|
71
|
+
#
|
72
|
+
# @raise [Chef::Exceptions::Secret::FetchFailed] if the secret could not be fetched
|
73
|
+
def do_fetch(identifier, version); raise NotImplementedError.new; end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Marc Paradise (<marc@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require_relative "base"
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
# == Chef::SecretFetcher::Example
|
23
|
+
# A simple implementation of a secrets fetcher.
|
24
|
+
# It expects to be initialized with a hash of
|
25
|
+
# keys and secret values.
|
26
|
+
#
|
27
|
+
# Usage Example:
|
28
|
+
#
|
29
|
+
# fetcher = SecretFetcher.for_service(:example, "secretkey1" => { "secret" => "lives here" })
|
30
|
+
# fetcher.fetch("secretkey1")
|
31
|
+
class SecretFetcher
|
32
|
+
class Example < Base
|
33
|
+
def validate!
|
34
|
+
if config.class != Hash
|
35
|
+
raise Chef::Exceptions::Secret::ConfigurationInvalid.new("The Example fetcher requires a hash of secrets")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def do_fetch(identifier, version)
|
40
|
+
raise Chef::Exceptions::Secret::FetchFailed.new("Secret #{identifier}) not found.") unless config.key?(identifier)
|
41
|
+
|
42
|
+
config[identifier]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Marc Paradise (<marc@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require_relative "exceptions"
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class SecretFetcher
|
23
|
+
|
24
|
+
SECRET_FETCHERS = %i{example aws_secrets_manager azure_key_vault}.freeze
|
25
|
+
|
26
|
+
# Returns a configured and validated instance
|
27
|
+
# of a [Chef::SecretFetcher::Base] for the given
|
28
|
+
# service and configuration.
|
29
|
+
#
|
30
|
+
# @param service [Symbol] the identifier for the service that will support this request. Must be in
|
31
|
+
# SECRET_FETCHERS
|
32
|
+
# @param config [Hash] configuration that the secrets service requires
|
33
|
+
# @param run_context [Chef::RunContext] the run context this is being invoked from
|
34
|
+
def self.for_service(service, config, run_context)
|
35
|
+
fetcher = case service
|
36
|
+
when :example
|
37
|
+
require_relative "secret_fetcher/example"
|
38
|
+
Chef::SecretFetcher::Example.new(config, run_context)
|
39
|
+
when :aws_secrets_manager
|
40
|
+
require_relative "secret_fetcher/aws_secrets_manager"
|
41
|
+
Chef::SecretFetcher::AWSSecretsManager.new(config, run_context)
|
42
|
+
when :azure_key_vault
|
43
|
+
require_relative "secret_fetcher/azure_key_vault"
|
44
|
+
Chef::SecretFetcher::AzureKeyVault.new(config, run_context)
|
45
|
+
when nil, ""
|
46
|
+
raise Chef::Exceptions::Secret::MissingFetcher.new(SECRET_FETCHERS)
|
47
|
+
else
|
48
|
+
raise Chef::Exceptions::Secret::InvalidFetcherService.new("Unsupported secret service: #{service}", SECRET_FETCHERS)
|
49
|
+
end
|
50
|
+
fetcher.validate!
|
51
|
+
fetcher
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
data/lib/chef/shell/ext.rb
CHANGED
@@ -198,9 +198,9 @@ module Shell
|
|
198
198
|
prints a detailed explanation of the command if available, or the
|
199
199
|
description if no explanation is available.
|
200
200
|
E
|
201
|
-
def help(
|
202
|
-
if
|
203
|
-
explain_command(
|
201
|
+
def help(command = nil)
|
202
|
+
if command
|
203
|
+
explain_command(command)
|
204
204
|
else
|
205
205
|
puts help_banner
|
206
206
|
end
|
data/lib/chef/version.rb
CHANGED
data/lib/chef/win32/api.rb
CHANGED
@@ -43,6 +43,8 @@ class Chef
|
|
43
43
|
|
44
44
|
host.ffi_convention :stdcall
|
45
45
|
|
46
|
+
win64 = ENV["PROCESSOR_ARCHITECTURE"] == "AMD64"
|
47
|
+
|
46
48
|
# Windows-specific type defs (ms-help://MS.MSDNQTR.v90.en/winprog/winprog/windows_data_types.htm):
|
47
49
|
host.typedef :ushort, :ATOM # Atom ~= Symbol: Atom table stores strings and corresponding identifiers. Application
|
48
50
|
# places a string in an atom table and receives a 16-bit integer, called an atom, that
|
@@ -120,10 +122,15 @@ class Chef
|
|
120
122
|
host.typedef :int32, :LONG32 # 32-bit signed integer. The range is -2,147,483,648 through +...647 decimal.
|
121
123
|
host.typedef :int64, :LONG64 # 64-bit signed integer. The range is –9,223,372,036,854,775,808 through +...807
|
122
124
|
host.typedef :int64, :LONGLONG # 64-bit signed integer. The range is –9,223,372,036,854,775,808 through +...807
|
123
|
-
host.typedef :long, :LONG_PTR # Signed long type for pointer precision. Use when casting a pointer to a long to
|
124
125
|
# perform pointer arithmetic. BaseTsd.h:
|
125
126
|
# if defined(_WIN64) host.typedef __int64 LONG_PTR; #else host.typedef long LONG_PTR;
|
126
|
-
|
127
|
+
if win64
|
128
|
+
host.typedef :int64, :LONG_PTR # Signed long type for pointer precision. Use when casting a pointer to a long to
|
129
|
+
host.typedef :int64, :LPARAM # Message parameter. WinDef.h as follows: #host.typedef LONG_PTR LPARAM;
|
130
|
+
else
|
131
|
+
host.typedef :long, :LONG_PTR # Signed long type for pointer precision. Use when casting a pointer to a long to
|
132
|
+
host.typedef :long, :LPARAM # Message parameter. WinDef.h as follows: #host.typedef LONG_PTR LPARAM;
|
133
|
+
end
|
127
134
|
host.typedef :pointer, :LPBOOL # Pointer to a BOOL. WinDef.h as follows: #host.typedef BOOL far *LPBOOL;
|
128
135
|
host.typedef :pointer, :LPBYTE # Pointer to a BYTE. WinDef.h as follows: #host.typedef BYTE far *LPBYTE;
|
129
136
|
host.typedef :pointer, :LPCOLORREF # Pointer to a COLORREF value. WinDef.h as follows: #host.typedef DWORD *LPCOLORREF;
|
File without changes
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module KnifeSpecs
|
2
|
+
class TestYourself < Chef::Knife
|
3
|
+
|
4
|
+
class << self
|
5
|
+
attr_reader :test_deps_loaded
|
6
|
+
end
|
7
|
+
|
8
|
+
deps do
|
9
|
+
@test_deps_loaded = true
|
10
|
+
end
|
11
|
+
|
12
|
+
option :scro, :short => '-s SCRO', :long => '--scro SCRO', :description => 'a configurable setting'
|
13
|
+
|
14
|
+
attr_reader :ran
|
15
|
+
|
16
|
+
def run
|
17
|
+
@ran = true
|
18
|
+
self # return self so tests can poke at me
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -18,12 +18,10 @@
|
|
18
18
|
require "spec_helper"
|
19
19
|
require "chef/mixin/shell_out"
|
20
20
|
|
21
|
-
#
|
22
|
-
|
23
|
-
# are consistently timing out in BuildKite. Once we've addressed this (see issue chef/11414)
|
24
|
-
# we will re-add the platform.
|
25
|
-
exclude_test = !(%w{rhel amazon}.include?(ohai[:platform_family]) && File.exist?("/usr/bin/dnf"))
|
21
|
+
# test on any fedora-ish platform with dnf
|
22
|
+
exclude_test = !(%w{rhel amazon fedora}.include?(OHAI_SYSTEM[:platform_family]) && File.exist?("/usr/bin/dnf"))
|
26
23
|
describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
24
|
+
include RecipeDSLHelper
|
27
25
|
include Chef::Mixin::ShellOut
|
28
26
|
|
29
27
|
# NOTE: every single test here either needs to explicitly call flush_cache or needs to explicitly
|
@@ -33,7 +31,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
33
31
|
def flush_cache
|
34
32
|
# needed on at least fc23/fc24 sometimes to deal with the dnf cache getting out of sync with the rpm db
|
35
33
|
FileUtils.rm_f "/var/cache/dnf/@System.solv"
|
36
|
-
Chef::
|
34
|
+
Chef::Provider::Package::Dnf::PythonHelper.instance.reap
|
37
35
|
end
|
38
36
|
|
39
37
|
def preinstall(*rpms)
|
@@ -43,11 +41,17 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
43
41
|
flush_cache
|
44
42
|
end
|
45
43
|
|
44
|
+
def expect_matching_installed_version(version)
|
45
|
+
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(version)
|
46
|
+
end
|
47
|
+
|
46
48
|
before(:all) do
|
47
49
|
shell_out!("dnf -y install dnf-plugins-core")
|
48
50
|
end
|
49
51
|
|
50
52
|
before(:each) do
|
53
|
+
# force errors to fail and not retry
|
54
|
+
ENV["DNF_HELPER_NO_RETRIES"] = "true"
|
51
55
|
File.open("/etc/yum.repos.d/chef-dnf-localtesting.repo", "w+") do |f|
|
52
56
|
f.write <<~EOF
|
53
57
|
[chef-dnf-localtesting]
|
@@ -57,6 +61,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
57
61
|
gpgcheck=0
|
58
62
|
EOF
|
59
63
|
end
|
64
|
+
# ensure we don't have any stray chef_rpms installed
|
60
65
|
shell_out!("rpm -qa --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' | grep chef_rpm | xargs -r rpm -e")
|
61
66
|
# next line is useful cleanup if you happen to have been testing both yum + dnf func tests on the same box and
|
62
67
|
# have some yum garbage left around
|
@@ -68,64 +73,71 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
68
73
|
FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
|
69
74
|
end
|
70
75
|
|
71
|
-
let(:
|
72
|
-
Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new)
|
73
|
-
end
|
74
|
-
|
75
|
-
let(:package_name) { "chef_rpm" }
|
76
|
-
let(:dnf_package) { Chef::Resource::DnfPackage.new(package_name, run_context) }
|
76
|
+
let(:default_options) { "--nogpgcheck --disablerepo=* --enablerepo=chef-dnf-localtesting" }
|
77
77
|
|
78
78
|
def pkg_arch
|
79
|
-
|
79
|
+
OHAI_SYSTEM[:kernel][:machine]
|
80
80
|
end
|
81
81
|
|
82
82
|
describe ":install" do
|
83
83
|
context "vanilla use case" do
|
84
|
-
let(:package_name) { "chef_rpm" }
|
85
|
-
|
86
84
|
it "installs if the package is not installed" do
|
87
85
|
flush_cache
|
88
|
-
dnf_package
|
89
|
-
|
86
|
+
dnf_package "chef_rpm" do
|
87
|
+
options default_options
|
88
|
+
action :install
|
89
|
+
end.should_be_updated
|
90
90
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
91
91
|
end
|
92
92
|
|
93
93
|
it "does not install if the package is installed" do
|
94
94
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
95
|
-
dnf_package
|
96
|
-
|
95
|
+
dnf_package "chef_rpm" do
|
96
|
+
options default_options
|
97
|
+
action :install
|
98
|
+
end.should_not_be_updated
|
97
99
|
end
|
98
100
|
|
99
101
|
it "does not install twice" do
|
100
102
|
flush_cache
|
101
|
-
dnf_package
|
102
|
-
|
103
|
+
dnf_package "chef_rpm" do
|
104
|
+
options default_options
|
105
|
+
action :install
|
106
|
+
end.should_be_updated
|
103
107
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
104
|
-
dnf_package
|
105
|
-
|
108
|
+
dnf_package "chef_rpm" do
|
109
|
+
options default_options
|
110
|
+
action :install
|
111
|
+
end.should_not_be_updated
|
106
112
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
107
113
|
end
|
108
114
|
|
109
115
|
it "does not install if the prior version package is installed" do
|
110
116
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
111
|
-
dnf_package
|
112
|
-
|
117
|
+
dnf_package "chef_rpm" do
|
118
|
+
options default_options
|
119
|
+
action :install
|
120
|
+
end.should_not_be_updated
|
113
121
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
114
122
|
end
|
115
123
|
|
116
124
|
it "does not install if the i686 package is installed", :intel_64bit do
|
117
125
|
skip "FIXME: do nothing, or install the #{pkg_arch} version?"
|
118
126
|
preinstall("chef_rpm-1.10-1.i686.rpm")
|
119
|
-
dnf_package
|
120
|
-
|
127
|
+
dnf_package "chef_rpm" do
|
128
|
+
options default_options
|
129
|
+
action :install
|
130
|
+
end.should_not_be_updated
|
121
131
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
|
122
132
|
end
|
123
133
|
|
124
134
|
it "does not install if the prior version i686 package is installed", :intel_64bit do
|
125
135
|
skip "FIXME: do nothing, or install the #{pkg_arch} version?"
|
126
136
|
preinstall("chef_rpm-1.2-1.i686.rpm")
|
127
|
-
dnf_package
|
128
|
-
|
137
|
+
dnf_package "chef_rpm" do
|
138
|
+
options default_options
|
139
|
+
action :install
|
140
|
+
end.should_not_be_updated
|
129
141
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.i686$")
|
130
142
|
end
|
131
143
|
end
|
@@ -134,72 +146,81 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
134
146
|
%w{1.10 1* 1.10-1 1*-1 1.10-* 1*-* 0:1.10 0:1* 0:1.10-1 0:1*-1 *:1.10-* *:1*-*}.each do |vstring|
|
135
147
|
it "installs the rpm when #{vstring} is in the package_name" do
|
136
148
|
flush_cache
|
137
|
-
dnf_package
|
138
|
-
|
139
|
-
|
149
|
+
dnf_package "chef_rpm-#{vstring}" do
|
150
|
+
options default_options
|
151
|
+
action :install
|
152
|
+
end.should_be_updated
|
140
153
|
end
|
141
154
|
|
142
155
|
it "is idempotent when #{vstring} is in the package_name" do
|
143
156
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
144
|
-
dnf_package
|
145
|
-
|
146
|
-
|
157
|
+
dnf_package "chef_rpm-#{vstring}" do
|
158
|
+
options default_options
|
159
|
+
action :install
|
160
|
+
end.should_not_be_updated
|
147
161
|
end
|
148
162
|
|
149
163
|
it "installs the rpm when #{vstring} is in the version property" do
|
150
164
|
flush_cache
|
151
|
-
dnf_package
|
152
|
-
|
153
|
-
|
154
|
-
|
165
|
+
dnf_package "chef_rpm" do
|
166
|
+
options default_options
|
167
|
+
version vstring
|
168
|
+
action :install
|
169
|
+
end.should_be_updated
|
155
170
|
end
|
156
171
|
|
157
172
|
it "is idempotent when #{vstring} is in the version property" do
|
158
173
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
159
|
-
dnf_package
|
160
|
-
|
161
|
-
|
162
|
-
|
174
|
+
dnf_package "chef_rpm" do
|
175
|
+
options default_options
|
176
|
+
version vstring
|
177
|
+
action :install
|
178
|
+
end.should_not_be_updated
|
163
179
|
end
|
164
180
|
|
165
181
|
it "upgrades the rpm when #{vstring} is in the package_name" do
|
166
182
|
flush_cache
|
167
|
-
dnf_package
|
168
|
-
|
169
|
-
|
183
|
+
dnf_package "chef_rpm-#{vstring}" do
|
184
|
+
options default_options
|
185
|
+
action :upgrade
|
186
|
+
end.should_be_updated
|
170
187
|
end
|
171
188
|
|
172
189
|
it "is idempotent when #{vstring} is in the package_name" do
|
173
190
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
174
|
-
dnf_package
|
175
|
-
|
176
|
-
|
191
|
+
dnf_package "chef_rpm-#{vstring}" do
|
192
|
+
options default_options
|
193
|
+
action :upgrade
|
194
|
+
end.should_not_be_updated
|
177
195
|
end
|
178
196
|
|
179
197
|
it "upgrades the rpm when #{vstring} is in the version property" do
|
180
198
|
flush_cache
|
181
|
-
dnf_package
|
182
|
-
|
183
|
-
|
184
|
-
|
199
|
+
dnf_package "chef_rpm" do
|
200
|
+
options default_options
|
201
|
+
version vstring
|
202
|
+
action :upgrade
|
203
|
+
end.should_be_updated
|
185
204
|
end
|
186
205
|
|
187
206
|
it "is idempotent when #{vstring} is in the version property" do
|
188
207
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
189
|
-
dnf_package
|
190
|
-
|
191
|
-
|
192
|
-
|
208
|
+
dnf_package "chef_rpm" do
|
209
|
+
options default_options
|
210
|
+
version vstring
|
211
|
+
action :upgrade
|
212
|
+
end.should_not_be_updated
|
193
213
|
end
|
194
214
|
end
|
195
215
|
|
196
216
|
%w{1.2 1* 1.2-1 1*-1 1.2-* 1*-* 0:1.2 0:1* 0:1.2-1 0:1*-1 *:1.2-* *:1*-*}.each do |vstring|
|
197
217
|
it "is idempotent when #{vstring} is in the version property and there is a candidate version" do
|
198
218
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
199
|
-
dnf_package
|
200
|
-
|
201
|
-
|
202
|
-
|
219
|
+
dnf_package "chef_rpm" do
|
220
|
+
options default_options
|
221
|
+
version vstring
|
222
|
+
action :install
|
223
|
+
end.should_not_be_updated
|
203
224
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
204
225
|
end
|
205
226
|
end
|
@@ -207,10 +228,11 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
207
228
|
%w{1.2 1.2-1 1.2-* 0:1.2 0:1.2-1 *:1.2-*}.each do |vstring|
|
208
229
|
it "is idempotent when #{vstring} is in the version property on upgrade and it doesn't match the candidate version" do
|
209
230
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
210
|
-
dnf_package
|
211
|
-
|
212
|
-
|
213
|
-
|
231
|
+
dnf_package "chef_rpm" do
|
232
|
+
options default_options
|
233
|
+
version vstring
|
234
|
+
action :upgrade
|
235
|
+
end.should_not_be_updated
|
214
236
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
215
237
|
end
|
216
238
|
end
|
@@ -218,13 +240,17 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
218
240
|
%w{1* 1*-1 1*-* 0:1* 0:1*-1 *:1*-*}.each do |vstring|
|
219
241
|
it "upgrades when #{vstring} is in the version property on upgrade and it matches the candidate version" do
|
220
242
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
221
|
-
dnf_package
|
222
|
-
|
223
|
-
|
224
|
-
|
243
|
+
dnf_package "chef_rpm" do
|
244
|
+
options default_options
|
245
|
+
version vstring
|
246
|
+
action :upgrade
|
247
|
+
end.should_be_updated
|
225
248
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
226
|
-
dnf_package
|
227
|
-
|
249
|
+
dnf_package "chef_rpm" do
|
250
|
+
options default_options
|
251
|
+
version vstring
|
252
|
+
action :upgrade
|
253
|
+
end.should_not_be_updated
|
228
254
|
end
|
229
255
|
end
|
230
256
|
end
|
@@ -232,82 +258,106 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
232
258
|
context "with versions or globs in the name" do
|
233
259
|
it "works with a version" do
|
234
260
|
flush_cache
|
235
|
-
dnf_package
|
236
|
-
|
237
|
-
|
261
|
+
dnf_package "chef_rpm-1.10" do
|
262
|
+
options default_options
|
263
|
+
action :install
|
264
|
+
end.should_be_updated
|
238
265
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
239
|
-
dnf_package.
|
240
|
-
|
266
|
+
dnf_package "chef_rpm-1.10" do
|
267
|
+
options default_options
|
268
|
+
action :install
|
269
|
+
end.should_not_be_updated
|
241
270
|
end
|
242
271
|
|
243
272
|
it "works with an older version" do
|
244
273
|
flush_cache
|
245
|
-
dnf_package
|
246
|
-
|
247
|
-
|
274
|
+
dnf_package "chef_rpm-1.2" do
|
275
|
+
options default_options
|
276
|
+
action :install
|
277
|
+
end.should_be_updated
|
248
278
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
249
|
-
dnf_package.
|
250
|
-
|
279
|
+
dnf_package "chef_rpm-1.2" do
|
280
|
+
options default_options
|
281
|
+
action :install
|
282
|
+
end.should_not_be_updated
|
251
283
|
end
|
252
284
|
|
253
285
|
it "works with an evra" do
|
254
286
|
flush_cache
|
255
|
-
dnf_package
|
256
|
-
|
257
|
-
|
287
|
+
dnf_package "chef_rpm-0:1.2-1.#{pkg_arch}" do
|
288
|
+
options default_options
|
289
|
+
action :install
|
290
|
+
end.should_be_updated
|
258
291
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
259
|
-
dnf_package.
|
260
|
-
|
292
|
+
dnf_package "chef_rpm-0:1.2-1.#{pkg_arch}" do
|
293
|
+
options default_options
|
294
|
+
action :install
|
295
|
+
end.should_not_be_updated
|
261
296
|
end
|
262
297
|
|
263
298
|
it "works with version and release" do
|
264
299
|
flush_cache
|
265
|
-
dnf_package
|
266
|
-
|
267
|
-
|
300
|
+
dnf_package "chef_rpm-1.2-1" do
|
301
|
+
options default_options
|
302
|
+
action :install
|
303
|
+
end.should_be_updated
|
268
304
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
269
|
-
dnf_package.
|
270
|
-
|
305
|
+
dnf_package "chef_rpm-1.2-1" do
|
306
|
+
options default_options
|
307
|
+
action :install
|
308
|
+
end.should_not_be_updated
|
271
309
|
end
|
272
310
|
|
273
311
|
it "works with a version glob" do
|
274
312
|
flush_cache
|
275
|
-
dnf_package
|
276
|
-
|
277
|
-
|
313
|
+
dnf_package "chef_rpm-1*" do
|
314
|
+
options default_options
|
315
|
+
action :install
|
316
|
+
end.should_be_updated
|
278
317
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
279
|
-
dnf_package
|
280
|
-
|
318
|
+
dnf_package "chef_rpm-1*" do
|
319
|
+
options default_options
|
320
|
+
action :install
|
321
|
+
end.should_not_be_updated
|
281
322
|
end
|
282
323
|
|
283
324
|
it "works with a name glob + version glob" do
|
284
325
|
flush_cache
|
285
|
-
dnf_package
|
286
|
-
|
287
|
-
|
326
|
+
dnf_package "chef_rp*-1*" do
|
327
|
+
options default_options
|
328
|
+
action :install
|
329
|
+
end.should_be_updated
|
288
330
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
289
|
-
dnf_package
|
290
|
-
|
331
|
+
dnf_package "chef_rp*-1*" do
|
332
|
+
options default_options
|
333
|
+
action :install
|
334
|
+
end.should_not_be_updated
|
291
335
|
end
|
292
336
|
|
293
337
|
it "upgrades when the installed version does not match the version string" do
|
294
338
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
295
|
-
dnf_package
|
296
|
-
|
297
|
-
|
339
|
+
dnf_package "chef_rpm-1.10" do
|
340
|
+
options default_options
|
341
|
+
action :install
|
342
|
+
end.should_be_updated
|
298
343
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}")
|
299
|
-
dnf_package.
|
300
|
-
|
344
|
+
dnf_package "chef_rpm-1.10" do
|
345
|
+
options default_options
|
346
|
+
action :install
|
347
|
+
end.should_not_be_updated
|
301
348
|
end
|
302
349
|
|
303
350
|
it "downgrades when the installed version is higher than the package_name version" do
|
304
351
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
305
|
-
dnf_package
|
306
|
-
|
307
|
-
|
352
|
+
dnf_package "chef_rpm-1.2" do
|
353
|
+
options default_options
|
354
|
+
action :install
|
355
|
+
end.should_be_updated
|
308
356
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
309
|
-
dnf_package.
|
310
|
-
|
357
|
+
dnf_package "chef_rpm-1.2" do
|
358
|
+
options default_options
|
359
|
+
action :install
|
360
|
+
end.should_not_be_updated
|
311
361
|
end
|
312
362
|
end
|
313
363
|
|
@@ -315,68 +365,92 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
315
365
|
context "with version property" do
|
316
366
|
it "matches the full version" do
|
317
367
|
flush_cache
|
318
|
-
dnf_package
|
319
|
-
|
320
|
-
|
321
|
-
|
368
|
+
dnf_package "chef_rpm" do
|
369
|
+
options default_options
|
370
|
+
version "1.10"
|
371
|
+
action :install
|
372
|
+
end.should_be_updated
|
322
373
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
323
|
-
dnf_package
|
324
|
-
|
374
|
+
dnf_package "chef_rpm" do
|
375
|
+
options default_options
|
376
|
+
version "1.10"
|
377
|
+
action :install
|
378
|
+
end.should_not_be_updated
|
325
379
|
end
|
326
380
|
|
327
381
|
it "matches with a glob" do
|
328
382
|
flush_cache
|
329
|
-
dnf_package
|
330
|
-
|
331
|
-
|
332
|
-
|
383
|
+
dnf_package "chef_rpm" do
|
384
|
+
options default_options
|
385
|
+
version "1*"
|
386
|
+
action :install
|
387
|
+
end.should_be_updated
|
333
388
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
334
|
-
dnf_package
|
335
|
-
|
389
|
+
dnf_package "chef_rpm" do
|
390
|
+
options default_options
|
391
|
+
version "1*"
|
392
|
+
action :install
|
393
|
+
end.should_not_be_updated
|
336
394
|
end
|
337
395
|
|
338
396
|
it "matches the vr" do
|
339
397
|
flush_cache
|
340
|
-
dnf_package
|
341
|
-
|
342
|
-
|
343
|
-
|
398
|
+
dnf_package "chef_rpm" do
|
399
|
+
options default_options
|
400
|
+
version "1.10-1"
|
401
|
+
action :install
|
402
|
+
end.should_be_updated
|
344
403
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
345
|
-
dnf_package
|
346
|
-
|
404
|
+
dnf_package "chef_rpm" do
|
405
|
+
options default_options
|
406
|
+
version "1.10-1"
|
407
|
+
action :install
|
408
|
+
end.should_not_be_updated
|
347
409
|
end
|
348
410
|
|
349
411
|
it "matches the evr" do
|
350
412
|
flush_cache
|
351
|
-
dnf_package
|
352
|
-
|
353
|
-
|
354
|
-
|
413
|
+
dnf_package "chef_rpm" do
|
414
|
+
options default_options
|
415
|
+
version "0:1.10-1"
|
416
|
+
action :install
|
417
|
+
end.should_be_updated
|
355
418
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
356
|
-
dnf_package
|
357
|
-
|
419
|
+
dnf_package "chef_rpm" do
|
420
|
+
options default_options
|
421
|
+
version "0:1.10-1"
|
422
|
+
action :install
|
423
|
+
end.should_not_be_updated
|
358
424
|
end
|
359
425
|
|
360
426
|
it "matches with a vr glob", :rhel_gte_8 do
|
361
427
|
flush_cache
|
362
|
-
dnf_package
|
363
|
-
|
364
|
-
|
365
|
-
|
428
|
+
dnf_package "chef_rpm" do
|
429
|
+
options default_options
|
430
|
+
version "1.10-1*"
|
431
|
+
action :install
|
432
|
+
end.should_be_updated
|
366
433
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
367
|
-
dnf_package
|
368
|
-
|
434
|
+
dnf_package "chef_rpm" do
|
435
|
+
options default_options
|
436
|
+
version "1.10-1*"
|
437
|
+
action :install
|
438
|
+
end.should_not_be_updated
|
369
439
|
end
|
370
440
|
|
371
441
|
it "matches with an evr glob", :rhel_gte_8 do
|
372
442
|
flush_cache
|
373
|
-
dnf_package
|
374
|
-
|
375
|
-
|
376
|
-
|
443
|
+
dnf_package "chef_rpm" do
|
444
|
+
options default_options
|
445
|
+
version "0:1.10-1*"
|
446
|
+
action :install
|
447
|
+
end.should_be_updated
|
377
448
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
378
|
-
dnf_package
|
379
|
-
|
449
|
+
dnf_package "chef_rpm" do
|
450
|
+
options default_options
|
451
|
+
version "0:1.10-1*"
|
452
|
+
action :install
|
453
|
+
end.should_not_be_updated
|
380
454
|
end
|
381
455
|
end
|
382
456
|
|
@@ -384,274 +458,345 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
384
458
|
it "downgrades the package when allow_downgrade" do
|
385
459
|
flush_cache
|
386
460
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
387
|
-
dnf_package
|
388
|
-
|
389
|
-
|
390
|
-
|
461
|
+
dnf_package "chef_rpm" do
|
462
|
+
options default_options
|
463
|
+
version "1.2-1"
|
464
|
+
action :install
|
465
|
+
end.should_be_updated
|
391
466
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
392
|
-
dnf_package
|
393
|
-
|
467
|
+
dnf_package "chef_rpm" do
|
468
|
+
options default_options
|
469
|
+
version "1.2-1"
|
470
|
+
action :install
|
471
|
+
end.should_not_be_updated
|
394
472
|
end
|
395
473
|
end
|
396
474
|
|
397
475
|
context "with arches", :intel_64bit do
|
398
476
|
it "installs with 64-bit arch in the name" do
|
399
477
|
flush_cache
|
400
|
-
dnf_package
|
401
|
-
|
402
|
-
|
478
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
479
|
+
options default_options
|
480
|
+
action :install
|
481
|
+
end.should_be_updated
|
403
482
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
404
|
-
dnf_package
|
405
|
-
|
483
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
484
|
+
options default_options
|
485
|
+
action :install
|
486
|
+
end.should_not_be_updated
|
406
487
|
end
|
407
488
|
|
408
489
|
it "installs with 32-bit arch in the name" do
|
409
490
|
flush_cache
|
410
|
-
dnf_package
|
411
|
-
|
412
|
-
|
491
|
+
dnf_package "chef_rpm.i686" do
|
492
|
+
options default_options
|
493
|
+
action :install
|
494
|
+
end.should_be_updated
|
413
495
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
|
414
|
-
dnf_package.
|
415
|
-
|
496
|
+
dnf_package "chef_rpm.i686" do
|
497
|
+
options default_options
|
498
|
+
action :install
|
499
|
+
end.should_not_be_updated
|
416
500
|
end
|
417
501
|
|
418
502
|
it "installs with 64-bit arch in the property" do
|
419
503
|
flush_cache
|
420
|
-
dnf_package
|
421
|
-
|
422
|
-
|
423
|
-
|
504
|
+
dnf_package "chef_rpm" do
|
505
|
+
options default_options
|
506
|
+
arch pkg_arch
|
507
|
+
action :install
|
508
|
+
end.should_be_updated
|
424
509
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
425
|
-
dnf_package
|
426
|
-
|
510
|
+
dnf_package "chef_rpm" do
|
511
|
+
options default_options
|
512
|
+
arch pkg_arch
|
513
|
+
action :install
|
514
|
+
end.should_not_be_updated
|
427
515
|
end
|
428
516
|
|
429
517
|
it "installs with 32-bit arch in the property" do
|
430
518
|
flush_cache
|
431
|
-
dnf_package
|
432
|
-
|
433
|
-
|
434
|
-
|
519
|
+
dnf_package "chef_rpm" do
|
520
|
+
options default_options
|
521
|
+
arch "i686"
|
522
|
+
action :install
|
523
|
+
end.should_be_updated
|
435
524
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
|
436
|
-
dnf_package
|
437
|
-
|
525
|
+
dnf_package "chef_rpm" do
|
526
|
+
options default_options
|
527
|
+
arch "i686"
|
528
|
+
action :install
|
529
|
+
end.should_not_be_updated
|
438
530
|
end
|
439
531
|
|
440
532
|
it "installs when the 32-bit arch is in the name and the version is in the property" do
|
441
533
|
flush_cache
|
442
|
-
dnf_package
|
443
|
-
|
444
|
-
|
445
|
-
|
534
|
+
dnf_package "chef_rpm.i686" do
|
535
|
+
options default_options
|
536
|
+
version "1.10-1"
|
537
|
+
action :install
|
538
|
+
end.should_be_updated
|
446
539
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
|
447
|
-
dnf_package.
|
448
|
-
|
540
|
+
dnf_package "chef_rpm.i686" do
|
541
|
+
options default_options
|
542
|
+
version "1.10-1"
|
543
|
+
action :install
|
544
|
+
end.should_not_be_updated
|
449
545
|
end
|
450
546
|
|
451
547
|
it "installs when the 64-bit arch is in the name and the version is in the property" do
|
452
548
|
flush_cache
|
453
|
-
dnf_package
|
454
|
-
|
455
|
-
|
456
|
-
|
549
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
550
|
+
options default_options
|
551
|
+
version "1.10-1"
|
552
|
+
action :install
|
553
|
+
end.should_be_updated
|
457
554
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
458
|
-
dnf_package
|
459
|
-
|
555
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
556
|
+
options default_options
|
557
|
+
version "1.10-1"
|
558
|
+
action :install
|
559
|
+
end.should_not_be_updated
|
460
560
|
end
|
461
561
|
end
|
462
562
|
|
463
563
|
context "with constraints" do
|
464
564
|
it "with nothing installed, it installs the latest version" do
|
465
565
|
flush_cache
|
466
|
-
dnf_package
|
467
|
-
|
468
|
-
|
566
|
+
dnf_package "chef_rpm >= 1.2" do
|
567
|
+
options default_options
|
568
|
+
action :install
|
569
|
+
end.should_be_updated
|
469
570
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
470
|
-
dnf_package.
|
471
|
-
|
571
|
+
dnf_package "chef_rpm >= 1.2" do
|
572
|
+
options default_options
|
573
|
+
action :install
|
574
|
+
end.should_not_be_updated
|
472
575
|
end
|
473
576
|
|
474
577
|
it "when it is met, it does nothing" do
|
475
578
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
476
|
-
dnf_package
|
477
|
-
|
478
|
-
|
579
|
+
dnf_package "chef_rpm >= 1.2" do
|
580
|
+
options default_options
|
581
|
+
action :install
|
582
|
+
end.should_not_be_updated
|
479
583
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
480
584
|
end
|
481
585
|
|
482
586
|
it "when it is met, it does nothing" do
|
483
587
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
484
|
-
dnf_package
|
485
|
-
|
486
|
-
|
588
|
+
dnf_package "chef_rpm >= 1.2" do
|
589
|
+
options default_options
|
590
|
+
action :install
|
591
|
+
end.should_not_be_updated
|
487
592
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
488
593
|
end
|
489
594
|
|
490
595
|
it "with nothing installed, it installs the latest version" do
|
491
596
|
flush_cache
|
492
|
-
dnf_package
|
493
|
-
|
494
|
-
|
597
|
+
dnf_package "chef_rpm > 1.2" do
|
598
|
+
options default_options
|
599
|
+
action :install
|
600
|
+
end.should_be_updated
|
495
601
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
496
|
-
dnf_package.
|
497
|
-
|
602
|
+
dnf_package "chef_rpm > 1.2" do
|
603
|
+
options default_options
|
604
|
+
action :install
|
605
|
+
end.should_not_be_updated
|
498
606
|
end
|
499
607
|
|
500
608
|
it "when it is not met by an installed rpm, it upgrades" do
|
501
609
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
502
|
-
dnf_package
|
503
|
-
|
504
|
-
|
610
|
+
dnf_package "chef_rpm > 1.2" do
|
611
|
+
options default_options
|
612
|
+
action :install
|
613
|
+
end.should_be_updated
|
505
614
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
506
|
-
dnf_package.
|
507
|
-
|
615
|
+
dnf_package "chef_rpm > 1.2" do
|
616
|
+
options default_options
|
617
|
+
action :install
|
618
|
+
end.should_not_be_updated
|
508
619
|
end
|
509
620
|
|
510
621
|
it "with an equality constraint, when it is not met by an installed rpm, it upgrades" do
|
511
622
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
512
|
-
dnf_package
|
513
|
-
|
514
|
-
|
623
|
+
dnf_package "chef_rpm = 1.10" do
|
624
|
+
options default_options
|
625
|
+
action :install
|
626
|
+
end.should_be_updated
|
515
627
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
516
|
-
dnf_package.
|
517
|
-
|
628
|
+
dnf_package "chef_rpm = 1.10" do
|
629
|
+
options default_options
|
630
|
+
action :install
|
631
|
+
end.should_not_be_updated
|
518
632
|
end
|
519
633
|
|
520
634
|
it "with an equality constraint, when it is met by an installed rpm, it does nothing" do
|
521
635
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
522
|
-
dnf_package
|
523
|
-
|
524
|
-
|
636
|
+
dnf_package "chef_rpm = 1.2" do
|
637
|
+
options default_options
|
638
|
+
action :install
|
639
|
+
end.should_not_be_updated
|
525
640
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
526
641
|
end
|
527
642
|
|
528
643
|
it "when it is met by an installed rpm, it does nothing" do
|
529
644
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
530
|
-
dnf_package
|
531
|
-
|
532
|
-
|
645
|
+
dnf_package "chef_rpm > 1.2" do
|
646
|
+
options default_options
|
647
|
+
action :install
|
648
|
+
end.should_not_be_updated
|
533
649
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
534
650
|
end
|
535
651
|
|
536
652
|
it "when there is no solution to the contraint" do
|
537
653
|
flush_cache
|
538
|
-
|
539
|
-
|
654
|
+
expect {
|
655
|
+
dnf_package "chef_rpm > 2.0"
|
656
|
+
}.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
|
540
657
|
end
|
541
658
|
|
542
659
|
it "when there is no solution to the contraint but an rpm is preinstalled" do
|
543
660
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
544
|
-
|
545
|
-
|
661
|
+
expect {
|
662
|
+
dnf_package "chef_rpm > 2.0"
|
663
|
+
}.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
|
546
664
|
end
|
547
665
|
|
548
666
|
it "with a less than constraint, when nothing is installed, it installs" do
|
549
667
|
flush_cache
|
550
|
-
dnf_package
|
551
|
-
|
552
|
-
|
668
|
+
dnf_package "chef_rpm < 1.10" do
|
669
|
+
options default_options
|
670
|
+
action :install
|
671
|
+
end.should_be_updated
|
553
672
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
554
|
-
dnf_package.
|
555
|
-
|
673
|
+
dnf_package "chef_rpm < 1.10" do
|
674
|
+
options default_options
|
675
|
+
action :install
|
676
|
+
end.should_not_be_updated
|
556
677
|
end
|
557
678
|
|
558
679
|
it "with a less than constraint, when the install version matches, it does nothing" do
|
559
680
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
560
|
-
dnf_package
|
561
|
-
|
562
|
-
|
681
|
+
dnf_package "chef_rpm < 1.10" do
|
682
|
+
options default_options
|
683
|
+
action :install
|
684
|
+
end.should_not_be_updated
|
563
685
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
564
686
|
end
|
565
687
|
|
566
688
|
it "with a less than constraint, when the install version fails, it should downgrade" do
|
567
689
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
568
|
-
dnf_package
|
569
|
-
|
570
|
-
|
690
|
+
dnf_package "chef_rpm < 1.10" do
|
691
|
+
options default_options
|
692
|
+
action :install
|
693
|
+
end.should_be_updated
|
571
694
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
572
|
-
dnf_package.
|
573
|
-
|
695
|
+
dnf_package "chef_rpm < 1.10" do
|
696
|
+
options default_options
|
697
|
+
action :install
|
698
|
+
end.should_not_be_updated
|
574
699
|
end
|
575
700
|
end
|
576
701
|
|
577
702
|
context "with source arguments" do
|
578
703
|
it "raises an exception when the package does not exist" do
|
579
704
|
flush_cache
|
580
|
-
|
581
|
-
|
705
|
+
expect {
|
706
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/this-file-better-not-exist.rpm"
|
707
|
+
}.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
|
582
708
|
end
|
583
709
|
|
584
710
|
it "does not raise a hard exception in why-run mode when the package does not exist" do
|
585
711
|
Chef::Config[:why_run] = true
|
586
712
|
flush_cache
|
587
|
-
dnf_package
|
588
|
-
|
589
|
-
|
713
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/this-file-better-not-exist.rpm" do
|
714
|
+
options default_options
|
715
|
+
action :install
|
716
|
+
end
|
590
717
|
end
|
591
718
|
|
592
719
|
it "installs the package when using the source argument" do
|
593
720
|
flush_cache
|
594
|
-
dnf_package
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
721
|
+
dnf_package "something" do
|
722
|
+
source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
723
|
+
options default_options
|
724
|
+
package_name "somethingelse"
|
725
|
+
name "something"
|
726
|
+
action :install
|
727
|
+
end.should_be_updated
|
599
728
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
600
|
-
dnf_package
|
601
|
-
|
729
|
+
dnf_package "something" do
|
730
|
+
source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
731
|
+
options default_options
|
732
|
+
package_name "somethingelse"
|
733
|
+
name "something"
|
734
|
+
action :install
|
735
|
+
end.should_not_be_updated
|
602
736
|
end
|
603
737
|
|
604
738
|
it "installs the package when the name is a path to a file" do
|
605
739
|
flush_cache
|
606
|
-
dnf_package
|
607
|
-
|
608
|
-
|
740
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
741
|
+
options default_options
|
742
|
+
action :install
|
743
|
+
end.should_be_updated
|
609
744
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
610
|
-
dnf_package.
|
611
|
-
|
745
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
746
|
+
options default_options
|
747
|
+
action :install
|
748
|
+
end.should_not_be_updated
|
612
749
|
end
|
613
750
|
|
614
751
|
it "downgrade on a local file with allow_downgrade true works" do
|
615
752
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
616
|
-
dnf_package
|
617
|
-
|
618
|
-
|
619
|
-
|
753
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
754
|
+
options default_options
|
755
|
+
version "1.2-1"
|
756
|
+
action :install
|
757
|
+
end.should_be_updated
|
620
758
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
621
|
-
dnf_package.
|
622
|
-
|
759
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
760
|
+
options default_options
|
761
|
+
version "1.2-1"
|
762
|
+
action :install
|
763
|
+
end.should_not_be_updated
|
623
764
|
end
|
624
765
|
|
625
766
|
it "does not downgrade the package with :install" do
|
626
767
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
627
|
-
dnf_package
|
628
|
-
|
629
|
-
|
768
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
769
|
+
options default_options
|
770
|
+
action :install
|
771
|
+
end.should_not_be_updated
|
630
772
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
631
773
|
end
|
632
774
|
|
633
775
|
it "does not upgrade the package with :install" do
|
634
776
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
635
|
-
dnf_package
|
636
|
-
|
637
|
-
|
777
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.10-1.#{pkg_arch}.rpm" do
|
778
|
+
options default_options
|
779
|
+
action :install
|
780
|
+
end.should_not_be_updated
|
638
781
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
639
782
|
end
|
640
783
|
|
641
784
|
it "is idempotent when the package is already installed" do
|
642
785
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
643
|
-
dnf_package
|
644
|
-
|
645
|
-
|
786
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
787
|
+
options default_options
|
788
|
+
action :install
|
789
|
+
end.should_not_be_updated
|
646
790
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
647
791
|
end
|
648
792
|
|
649
793
|
it "is idempotent when the package is already installed and there is a version string" do
|
650
794
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
651
|
-
dnf_package
|
652
|
-
|
653
|
-
|
654
|
-
|
795
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
796
|
+
options default_options
|
797
|
+
version "1.2-1"
|
798
|
+
action :install
|
799
|
+
end.should_not_be_updated
|
655
800
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
656
801
|
end
|
657
802
|
end
|
@@ -660,142 +805,183 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
660
805
|
it "works when a package is installed" do
|
661
806
|
FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
|
662
807
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
663
|
-
dnf_package
|
664
|
-
|
808
|
+
dnf_package "chef_rpm" do
|
809
|
+
options "--nogpgcheck --disablerepo=*"
|
810
|
+
action :install
|
811
|
+
end.should_not_be_updated
|
665
812
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
666
813
|
end
|
667
814
|
|
668
815
|
it "works with a local source" do
|
669
816
|
FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
|
670
817
|
flush_cache
|
671
|
-
dnf_package
|
672
|
-
|
673
|
-
|
818
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
819
|
+
options "--nogpgcheck --disablerepo=*"
|
820
|
+
action :install
|
821
|
+
end.should_be_updated
|
674
822
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
675
|
-
dnf_package.
|
676
|
-
|
823
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
824
|
+
options "--nogpgcheck --disablerepo=*"
|
825
|
+
action :install
|
826
|
+
end.should_not_be_updated
|
677
827
|
end
|
678
828
|
end
|
679
829
|
|
680
830
|
context "multipackage with arches", :intel_64bit do
|
681
831
|
it "installs two rpms" do
|
682
832
|
flush_cache
|
683
|
-
dnf_package
|
684
|
-
|
685
|
-
|
833
|
+
dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
|
834
|
+
options default_options
|
835
|
+
action :install
|
836
|
+
end.should_be_updated
|
686
837
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
687
838
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
688
|
-
dnf_package.
|
689
|
-
|
839
|
+
dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
|
840
|
+
options default_options
|
841
|
+
action :install
|
842
|
+
end.should_not_be_updated
|
690
843
|
end
|
691
844
|
|
692
845
|
it "does nothing if both are installed" do
|
693
846
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm", "chef_rpm-1.10-1.i686.rpm")
|
694
847
|
flush_cache
|
695
|
-
dnf_package
|
696
|
-
|
697
|
-
|
848
|
+
dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
|
849
|
+
options default_options
|
850
|
+
action :install
|
851
|
+
end.should_not_be_updated
|
698
852
|
end
|
699
853
|
|
700
854
|
it "installs the second rpm if the first is installed" do
|
701
855
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
702
|
-
dnf_package
|
703
|
-
|
704
|
-
|
856
|
+
dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
|
857
|
+
options default_options
|
858
|
+
action :install
|
859
|
+
end.should_be_updated
|
705
860
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
706
861
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
707
|
-
dnf_package.
|
708
|
-
|
862
|
+
dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
|
863
|
+
options default_options
|
864
|
+
action :install
|
865
|
+
end.should_not_be_updated
|
709
866
|
end
|
710
867
|
|
711
868
|
it "installs the first rpm if the second is installed" do
|
712
869
|
preinstall("chef_rpm-1.10-1.i686.rpm")
|
713
|
-
dnf_package
|
714
|
-
|
715
|
-
|
870
|
+
dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
|
871
|
+
options default_options
|
872
|
+
action :install
|
873
|
+
end.should_be_updated
|
716
874
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
717
875
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
718
|
-
dnf_package.
|
719
|
-
|
876
|
+
dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
|
877
|
+
options default_options
|
878
|
+
action :install
|
879
|
+
end.should_not_be_updated
|
720
880
|
end
|
721
881
|
|
722
882
|
# unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
|
723
883
|
it "installs two rpms with multi-arch" do
|
724
884
|
flush_cache
|
725
|
-
dnf_package
|
726
|
-
|
727
|
-
|
728
|
-
|
885
|
+
dnf_package %w{chef_rpm chef_rpm} do
|
886
|
+
options default_options
|
887
|
+
arch [pkg_arch, "i686"]
|
888
|
+
action :install
|
889
|
+
end.should_be_updated
|
729
890
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
730
891
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
731
|
-
dnf_package
|
732
|
-
|
892
|
+
dnf_package %w{chef_rpm chef_rpm} do
|
893
|
+
options default_options
|
894
|
+
arch [pkg_arch, "i686"]
|
895
|
+
action :install
|
896
|
+
end.should_not_be_updated
|
733
897
|
end
|
734
898
|
|
735
899
|
# unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
|
736
900
|
it "installs the second rpm if the first is installed (muti-arch)" do
|
737
901
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
738
|
-
dnf_package
|
739
|
-
|
740
|
-
|
741
|
-
|
902
|
+
dnf_package %w{chef_rpm chef_rpm} do
|
903
|
+
options default_options
|
904
|
+
arch [pkg_arch, "i686"]
|
905
|
+
action :install
|
906
|
+
end.should_be_updated
|
742
907
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
743
908
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
744
|
-
dnf_package
|
745
|
-
|
909
|
+
dnf_package %w{chef_rpm chef_rpm} do
|
910
|
+
options default_options
|
911
|
+
action :install
|
912
|
+
end.should_not_be_updated
|
746
913
|
end
|
747
914
|
|
748
915
|
# unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
|
749
916
|
it "installs the first rpm if the second is installed (muti-arch)" do
|
750
917
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
751
|
-
dnf_package
|
752
|
-
|
753
|
-
|
754
|
-
|
918
|
+
dnf_package %w{chef_rpm chef_rpm} do
|
919
|
+
options default_options
|
920
|
+
arch [pkg_arch, "i686"]
|
921
|
+
action :install
|
922
|
+
end.should_be_updated
|
755
923
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
756
924
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
757
|
-
dnf_package
|
758
|
-
|
925
|
+
dnf_package %w{chef_rpm chef_rpm} do
|
926
|
+
options default_options
|
927
|
+
action :install
|
928
|
+
end.should_not_be_updated
|
759
929
|
end
|
760
930
|
|
761
931
|
# unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
|
762
932
|
it "does nothing if both are installed (muti-arch)" do
|
763
933
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm", "chef_rpm-1.10-1.i686.rpm")
|
764
|
-
dnf_package
|
765
|
-
|
766
|
-
|
767
|
-
|
934
|
+
dnf_package %w{chef_rpm chef_rpm} do
|
935
|
+
options default_options
|
936
|
+
arch [pkg_arch, "i686"]
|
937
|
+
action :install
|
938
|
+
end.should_not_be_updated
|
768
939
|
end
|
769
940
|
end
|
770
941
|
|
771
942
|
context "repo controls" do
|
772
943
|
it "should fail with the repo disabled" do
|
773
944
|
flush_cache
|
774
|
-
|
775
|
-
|
945
|
+
expect {
|
946
|
+
dnf_package "chef_rpm" do
|
947
|
+
options "--nogpgcheck --disablerepo=chef-dnf-localtesting"
|
948
|
+
action :install
|
949
|
+
end
|
950
|
+
}.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
|
776
951
|
end
|
777
952
|
|
778
953
|
it "should work with disablerepo first" do
|
779
954
|
flush_cache
|
780
|
-
dnf_package
|
781
|
-
|
782
|
-
|
955
|
+
dnf_package "chef_rpm" do
|
956
|
+
options ["--nogpgcheck", "--disablerepo=*", "--enablerepo=chef-dnf-localtesting"]
|
957
|
+
action :install
|
958
|
+
end.should_be_updated
|
783
959
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
784
|
-
dnf_package
|
785
|
-
|
960
|
+
dnf_package "chef_rpm" do
|
961
|
+
options ["--nogpgcheck", "--disablerepo=*", "--enablerepo=chef-dnf-localtesting"]
|
962
|
+
action :install
|
963
|
+
end.should_not_be_updated
|
786
964
|
end
|
787
965
|
|
788
966
|
it "should work to enable a disabled repo" do
|
789
967
|
shell_out!("dnf config-manager --set-disabled chef-dnf-localtesting")
|
790
968
|
flush_cache
|
791
|
-
expect {
|
969
|
+
expect {
|
970
|
+
dnf_package "chef_rpm" do
|
971
|
+
options "--nogpgcheck"
|
972
|
+
action :install
|
973
|
+
end
|
974
|
+
}.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
|
792
975
|
flush_cache
|
793
|
-
dnf_package
|
794
|
-
|
795
|
-
|
976
|
+
dnf_package "chef_rpm" do
|
977
|
+
options "--nogpgcheck --enablerepo=chef-dnf-localtesting"
|
978
|
+
action :install
|
979
|
+
end.should_be_updated
|
796
980
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
797
|
-
dnf_package
|
798
|
-
|
981
|
+
dnf_package "chef_rpm" do
|
982
|
+
options "--nogpgcheck --enablerepo=chef-dnf-localtesting"
|
983
|
+
action :install
|
984
|
+
end.should_not_be_updated
|
799
985
|
end
|
800
986
|
|
801
987
|
it "when an idempotent install action is run, does not leave repos disabled" do
|
@@ -805,19 +991,22 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
805
991
|
# accomplishes both those goals (it would be easier if we had other rpms in this repo, but with
|
806
992
|
# one rpm we need to do this).
|
807
993
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
808
|
-
dnf_package
|
809
|
-
|
810
|
-
|
994
|
+
dnf_package "chef_rpm" do
|
995
|
+
options "--nogpgcheck --disablerepo=chef-dnf-localtesting"
|
996
|
+
action :upgrade
|
997
|
+
end.should_not_be_updated
|
811
998
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
812
999
|
# now we're still using the same cache in the dnf_helper.py cache and we test to see if the
|
813
1000
|
# repo that we temporarily disabled is enabled on this pass.
|
814
|
-
dnf_package
|
815
|
-
|
816
|
-
|
817
|
-
|
1001
|
+
dnf_package "chef_rpm-1.10-1.#{pkg_arch}" do
|
1002
|
+
options "--nogpgcheck"
|
1003
|
+
action :install
|
1004
|
+
end.should_be_updated
|
818
1005
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
819
|
-
dnf_package.
|
820
|
-
|
1006
|
+
dnf_package "chef_rpm-1.10-1.#{pkg_arch}" do
|
1007
|
+
options "--nogpgcheck"
|
1008
|
+
action :install
|
1009
|
+
end.should_not_be_updated
|
821
1010
|
end
|
822
1011
|
end
|
823
1012
|
end
|
@@ -826,76 +1015,102 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
826
1015
|
context "downgrades" do
|
827
1016
|
it "just work with DNF" do
|
828
1017
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
829
|
-
dnf_package
|
830
|
-
|
831
|
-
|
1018
|
+
dnf_package "chef_rpm" do
|
1019
|
+
options default_options
|
1020
|
+
version "1.2"
|
1021
|
+
action :install
|
1022
|
+
end.should_be_updated
|
832
1023
|
expect(shell_out("rpm -q chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}")
|
833
|
-
dnf_package
|
834
|
-
|
1024
|
+
dnf_package "chef_rpm" do
|
1025
|
+
options default_options
|
1026
|
+
version "1.2"
|
1027
|
+
action :install
|
1028
|
+
end.should_not_be_updated
|
835
1029
|
end
|
836
1030
|
|
837
1031
|
it "throws a deprecation warning with allow_downgrade" do
|
838
1032
|
Chef::Config[:treat_deprecation_warnings_as_errors] = false
|
839
|
-
expect(Chef).to receive(:deprecated).with(:dnf_package_allow_downgrade, /^the allow_downgrade property on the dnf_package provider is not used/)
|
1033
|
+
expect(Chef).to receive(:deprecated).at_least(:once).with(:dnf_package_allow_downgrade, /^the allow_downgrade property on the dnf_package provider is not used/)
|
840
1034
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
841
|
-
dnf_package
|
842
|
-
|
843
|
-
|
844
|
-
|
1035
|
+
dnf_package "chef_rpm" do
|
1036
|
+
options default_options
|
1037
|
+
version "1.2"
|
1038
|
+
allow_downgrade true
|
1039
|
+
action :install
|
1040
|
+
end.should_be_updated
|
845
1041
|
expect(shell_out("rpm -q chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}")
|
846
|
-
dnf_package
|
847
|
-
|
1042
|
+
dnf_package "chef_rpm" do
|
1043
|
+
options default_options
|
1044
|
+
version "1.2"
|
1045
|
+
allow_downgrade true
|
1046
|
+
action :install
|
1047
|
+
end.should_not_be_updated
|
848
1048
|
end
|
849
1049
|
end
|
850
1050
|
|
851
1051
|
context "with source arguments" do
|
852
1052
|
it "installs the package when using the source argument" do
|
853
1053
|
flush_cache
|
854
|
-
dnf_package
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
1054
|
+
dnf_package "something" do
|
1055
|
+
options default_options
|
1056
|
+
package_name "somethingelse"
|
1057
|
+
source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1058
|
+
action :upgrade
|
1059
|
+
end.should_be_updated
|
859
1060
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
860
|
-
dnf_package
|
861
|
-
|
1061
|
+
dnf_package "something" do
|
1062
|
+
options default_options
|
1063
|
+
package_name "somethingelse"
|
1064
|
+
source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1065
|
+
action :upgrade
|
1066
|
+
end.should_not_be_updated
|
862
1067
|
end
|
863
1068
|
|
864
1069
|
it "installs the package when the name is a path to a file" do
|
865
1070
|
flush_cache
|
866
|
-
dnf_package
|
867
|
-
|
868
|
-
|
1071
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1072
|
+
options default_options
|
1073
|
+
action :upgrade
|
1074
|
+
end.should_be_updated
|
869
1075
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
870
|
-
dnf_package.
|
871
|
-
|
1076
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1077
|
+
options default_options
|
1078
|
+
action :upgrade
|
1079
|
+
end.should_not_be_updated
|
872
1080
|
end
|
873
1081
|
|
874
1082
|
it "downgrades the package when allow_downgrade is true" do
|
875
1083
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
876
|
-
dnf_package
|
877
|
-
|
878
|
-
|
1084
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1085
|
+
options default_options
|
1086
|
+
action :upgrade
|
1087
|
+
end.should_be_updated
|
879
1088
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
880
|
-
dnf_package.
|
881
|
-
|
1089
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1090
|
+
options default_options
|
1091
|
+
action :upgrade
|
1092
|
+
end.should_not_be_updated
|
882
1093
|
end
|
883
1094
|
|
884
1095
|
it "upgrades the package" do
|
885
1096
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
886
|
-
dnf_package
|
887
|
-
|
888
|
-
|
1097
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.10-1.#{pkg_arch}.rpm" do
|
1098
|
+
options default_options
|
1099
|
+
action :upgrade
|
1100
|
+
end.should_be_updated
|
889
1101
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
890
|
-
dnf_package.
|
891
|
-
|
1102
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.10-1.#{pkg_arch}.rpm" do
|
1103
|
+
options default_options
|
1104
|
+
action :upgrade
|
1105
|
+
end.should_not_be_updated
|
892
1106
|
end
|
893
1107
|
|
894
1108
|
it "is idempotent when the package is already installed" do
|
895
1109
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
896
|
-
dnf_package
|
897
|
-
|
898
|
-
|
1110
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1111
|
+
options default_options
|
1112
|
+
action :upgrade
|
1113
|
+
end.should_not_be_updated
|
899
1114
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
900
1115
|
end
|
901
1116
|
end
|
@@ -904,295 +1119,382 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
904
1119
|
it "works when a package is installed" do
|
905
1120
|
FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
|
906
1121
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
907
|
-
dnf_package
|
908
|
-
|
909
|
-
|
1122
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1123
|
+
options "--nogpgcheck --disablerepo=*"
|
1124
|
+
action :upgrade
|
1125
|
+
end.should_not_be_updated
|
910
1126
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
911
1127
|
end
|
912
1128
|
|
913
1129
|
it "works with a local source" do
|
914
1130
|
FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
|
915
1131
|
flush_cache
|
916
|
-
dnf_package
|
917
|
-
|
918
|
-
|
1132
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1133
|
+
options "--nogpgcheck --disablerepo=*"
|
1134
|
+
action :upgrade
|
1135
|
+
end.should_be_updated
|
919
1136
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
920
|
-
dnf_package.
|
921
|
-
|
1137
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1138
|
+
options default_options
|
1139
|
+
action :upgrade
|
1140
|
+
end.should_not_be_updated
|
922
1141
|
end
|
923
1142
|
end
|
924
1143
|
|
925
1144
|
context "version pinning" do
|
926
1145
|
it "with a full version pin it installs a later package" do
|
927
1146
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
928
|
-
dnf_package
|
929
|
-
|
930
|
-
|
931
|
-
|
1147
|
+
dnf_package "chef_rpm" do
|
1148
|
+
options default_options
|
1149
|
+
version "1.10-1"
|
1150
|
+
action :upgrade
|
1151
|
+
end.should_be_updated
|
932
1152
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
933
|
-
dnf_package
|
934
|
-
|
1153
|
+
dnf_package "chef_rpm" do
|
1154
|
+
options default_options
|
1155
|
+
version "1.10-1"
|
1156
|
+
action :upgrade
|
1157
|
+
end.should_not_be_updated
|
935
1158
|
end
|
936
1159
|
|
937
1160
|
it "with a full version pin in the name it downgrades the package" do
|
938
1161
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
939
|
-
dnf_package
|
940
|
-
|
941
|
-
|
942
|
-
|
1162
|
+
dnf_package "chef_rpm" do
|
1163
|
+
options default_options
|
1164
|
+
version "1.2-1"
|
1165
|
+
action :upgrade
|
1166
|
+
end.should_be_updated
|
943
1167
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
944
|
-
dnf_package
|
945
|
-
|
1168
|
+
dnf_package "chef_rpm" do
|
1169
|
+
options default_options
|
1170
|
+
version "1.2-1"
|
1171
|
+
action :upgrade
|
1172
|
+
end.should_not_be_updated
|
946
1173
|
end
|
947
1174
|
|
948
1175
|
it "with a partial (no release) version pin it installs a later package" do
|
949
1176
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
950
|
-
dnf_package
|
951
|
-
|
952
|
-
|
953
|
-
|
1177
|
+
dnf_package "chef_rpm" do
|
1178
|
+
options default_options
|
1179
|
+
version "1.10"
|
1180
|
+
action :upgrade
|
1181
|
+
end.should_be_updated
|
954
1182
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
955
|
-
dnf_package
|
956
|
-
|
1183
|
+
dnf_package "chef_rpm" do
|
1184
|
+
options default_options
|
1185
|
+
version "1.10"
|
1186
|
+
action :upgrade
|
1187
|
+
end.should_not_be_updated
|
957
1188
|
end
|
958
1189
|
|
959
1190
|
it "with a partial (no release) version pin in the name it downgrades the package" do
|
960
1191
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
961
|
-
dnf_package
|
962
|
-
|
963
|
-
|
964
|
-
|
1192
|
+
dnf_package "chef_rpm" do
|
1193
|
+
options default_options
|
1194
|
+
version("1.2")
|
1195
|
+
action :upgrade
|
1196
|
+
end.should_be_updated
|
965
1197
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
966
|
-
dnf_package
|
967
|
-
|
1198
|
+
dnf_package "chef_rpm" do
|
1199
|
+
options default_options
|
1200
|
+
version("1.2")
|
1201
|
+
action :upgrade
|
1202
|
+
end.should_not_be_updated
|
968
1203
|
end
|
969
1204
|
|
970
1205
|
it "with a full version pin it installs a later package" do
|
971
1206
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
972
|
-
dnf_package
|
973
|
-
|
974
|
-
|
1207
|
+
dnf_package "chef_rpm-1.10-1" do
|
1208
|
+
options default_options
|
1209
|
+
action :upgrade
|
1210
|
+
end.should_be_updated
|
975
1211
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
976
|
-
dnf_package.
|
977
|
-
|
1212
|
+
dnf_package "chef_rpm-1.10-1" do
|
1213
|
+
options default_options
|
1214
|
+
action :upgrade
|
1215
|
+
end.should_not_be_updated
|
978
1216
|
end
|
979
1217
|
|
980
1218
|
it "with a full version pin in the name it downgrades the package" do
|
981
1219
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
982
|
-
dnf_package
|
983
|
-
|
984
|
-
|
1220
|
+
dnf_package "chef_rpm-1.2-1" do
|
1221
|
+
options default_options
|
1222
|
+
action :upgrade
|
1223
|
+
end.should_be_updated
|
985
1224
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
986
|
-
dnf_package.
|
987
|
-
|
1225
|
+
dnf_package "chef_rpm-1.2-1" do
|
1226
|
+
options default_options
|
1227
|
+
action :upgrade
|
1228
|
+
end.should_not_be_updated
|
988
1229
|
end
|
989
1230
|
|
990
1231
|
it "with a partial (no release) version pin it installs a later package" do
|
991
1232
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
992
|
-
dnf_package
|
993
|
-
|
994
|
-
|
1233
|
+
dnf_package "chef_rpm-1.10" do
|
1234
|
+
options default_options
|
1235
|
+
action :upgrade
|
1236
|
+
end.should_be_updated
|
995
1237
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
996
|
-
dnf_package.
|
997
|
-
|
1238
|
+
dnf_package "chef_rpm-1.10" do
|
1239
|
+
options default_options
|
1240
|
+
action :upgrade
|
1241
|
+
end.should_not_be_updated
|
998
1242
|
end
|
999
1243
|
|
1000
1244
|
it "with a partial (no release) version pin in the name it downgrades the package" do
|
1001
1245
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
1002
|
-
dnf_package
|
1003
|
-
|
1004
|
-
|
1246
|
+
dnf_package "chef_rpm-1.2" do
|
1247
|
+
options default_options
|
1248
|
+
action :upgrade
|
1249
|
+
end.should_be_updated
|
1005
1250
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
1006
|
-
dnf_package.
|
1007
|
-
|
1251
|
+
dnf_package "chef_rpm-1.2" do
|
1252
|
+
options default_options
|
1253
|
+
action :upgrade
|
1254
|
+
end.should_not_be_updated
|
1008
1255
|
end
|
1009
1256
|
|
1010
1257
|
it "with a prco equality pin in the name it upgrades a prior package" do
|
1011
1258
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1012
|
-
dnf_package
|
1013
|
-
|
1014
|
-
|
1259
|
+
dnf_package "chef_rpm = 1.10" do
|
1260
|
+
options default_options
|
1261
|
+
action :upgrade
|
1262
|
+
end.should_be_updated
|
1015
1263
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
1016
|
-
dnf_package.
|
1017
|
-
|
1264
|
+
dnf_package "chef_rpm = 1.10" do
|
1265
|
+
options default_options
|
1266
|
+
action :upgrade
|
1267
|
+
end.should_not_be_updated
|
1018
1268
|
end
|
1019
1269
|
|
1020
1270
|
it "with a prco equality pin in the name it downgrades a later package" do
|
1021
1271
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
1022
|
-
dnf_package
|
1023
|
-
|
1024
|
-
|
1272
|
+
dnf_package "chef_rpm = 1.2" do
|
1273
|
+
options default_options
|
1274
|
+
action :upgrade
|
1275
|
+
end.should_be_updated
|
1025
1276
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
1026
|
-
dnf_package.
|
1027
|
-
|
1277
|
+
dnf_package "chef_rpm = 1.2" do
|
1278
|
+
options default_options
|
1279
|
+
action :upgrade
|
1280
|
+
end.should_not_be_updated
|
1028
1281
|
end
|
1029
1282
|
|
1030
1283
|
it "with a > pin in the name and no rpm installed it installs" do
|
1031
1284
|
flush_cache
|
1032
|
-
dnf_package
|
1033
|
-
|
1034
|
-
|
1285
|
+
dnf_package "chef_rpm > 1.2" do
|
1286
|
+
options default_options
|
1287
|
+
action :upgrade
|
1288
|
+
end.should_be_updated
|
1035
1289
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
1036
|
-
dnf_package.
|
1037
|
-
|
1290
|
+
dnf_package "chef_rpm > 1.2" do
|
1291
|
+
options default_options
|
1292
|
+
action :upgrade
|
1293
|
+
end.should_not_be_updated
|
1038
1294
|
end
|
1039
1295
|
|
1040
1296
|
it "with a < pin in the name and no rpm installed it installs" do
|
1041
1297
|
flush_cache
|
1042
|
-
dnf_package
|
1043
|
-
|
1044
|
-
|
1298
|
+
dnf_package "chef_rpm < 1.10" do
|
1299
|
+
options default_options
|
1300
|
+
action :upgrade
|
1301
|
+
end.should_be_updated
|
1045
1302
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
1046
|
-
dnf_package.
|
1047
|
-
|
1303
|
+
dnf_package "chef_rpm < 1.10" do
|
1304
|
+
options default_options
|
1305
|
+
action :upgrade
|
1306
|
+
end.should_not_be_updated
|
1048
1307
|
end
|
1049
1308
|
|
1050
1309
|
it "with a > pin in the name and matching rpm installed it does nothing" do
|
1051
1310
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
1052
|
-
dnf_package
|
1053
|
-
|
1054
|
-
|
1311
|
+
dnf_package "chef_rpm > 1.2" do
|
1312
|
+
options default_options
|
1313
|
+
action :upgrade
|
1314
|
+
end.should_not_be_updated
|
1055
1315
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
1056
1316
|
end
|
1057
1317
|
|
1058
1318
|
it "with a < pin in the name and no rpm installed it installs" do
|
1059
1319
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1060
|
-
dnf_package
|
1061
|
-
|
1062
|
-
|
1320
|
+
dnf_package "chef_rpm < 1.10" do
|
1321
|
+
options default_options
|
1322
|
+
action :upgrade
|
1323
|
+
end.should_not_be_updated
|
1063
1324
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
1064
1325
|
end
|
1065
1326
|
|
1066
1327
|
it "with a > pin in the name and non-matching rpm installed it upgrades" do
|
1067
1328
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1068
|
-
dnf_package
|
1069
|
-
|
1070
|
-
|
1329
|
+
dnf_package "chef_rpm > 1.2" do
|
1330
|
+
options default_options
|
1331
|
+
action :upgrade
|
1332
|
+
end.should_be_updated
|
1071
1333
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
1072
|
-
dnf_package.
|
1073
|
-
|
1334
|
+
dnf_package "chef_rpm > 1.2" do
|
1335
|
+
options default_options
|
1336
|
+
action :upgrade
|
1337
|
+
end.should_not_be_updated
|
1074
1338
|
end
|
1075
1339
|
|
1076
1340
|
it "with a < pin in the name and non-matching rpm installed it downgrades" do
|
1077
1341
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
1078
|
-
dnf_package
|
1079
|
-
|
1080
|
-
|
1342
|
+
dnf_package "chef_rpm < 1.10" do
|
1343
|
+
options default_options
|
1344
|
+
action :upgrade
|
1345
|
+
end.should_be_updated
|
1081
1346
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
1082
|
-
dnf_package.
|
1083
|
-
|
1347
|
+
dnf_package "chef_rpm < 1.10" do
|
1348
|
+
options default_options
|
1349
|
+
action :upgrade
|
1350
|
+
end.should_not_be_updated
|
1084
1351
|
end
|
1085
1352
|
end
|
1086
1353
|
end
|
1087
1354
|
|
1088
1355
|
describe ":remove" do
|
1089
1356
|
context "vanilla use case" do
|
1090
|
-
let(:package_name) { "chef_rpm" }
|
1091
1357
|
it "does nothing if the package is not installed" do
|
1092
1358
|
flush_cache
|
1093
|
-
dnf_package
|
1094
|
-
|
1359
|
+
dnf_package "chef_rpm" do
|
1360
|
+
options default_options
|
1361
|
+
action :remove
|
1362
|
+
end.should_not_be_updated
|
1095
1363
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1096
1364
|
end
|
1097
1365
|
|
1098
1366
|
it "removes the package if the package is installed" do
|
1099
1367
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
1100
|
-
dnf_package
|
1101
|
-
|
1368
|
+
dnf_package "chef_rpm" do
|
1369
|
+
options default_options
|
1370
|
+
action :remove
|
1371
|
+
end.should_be_updated
|
1102
1372
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1103
1373
|
end
|
1104
1374
|
|
1105
1375
|
it "does not remove the package twice" do
|
1106
1376
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
1107
|
-
dnf_package
|
1108
|
-
|
1377
|
+
dnf_package "chef_rpm" do
|
1378
|
+
options default_options
|
1379
|
+
action :remove
|
1380
|
+
end.should_be_updated
|
1109
1381
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1110
|
-
dnf_package
|
1111
|
-
|
1382
|
+
dnf_package "chef_rpm" do
|
1383
|
+
options default_options
|
1384
|
+
action :remove
|
1385
|
+
end.should_not_be_updated
|
1112
1386
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1113
1387
|
end
|
1114
1388
|
|
1115
1389
|
it "removes the package if the prior version package is installed" do
|
1116
1390
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1117
|
-
dnf_package
|
1118
|
-
|
1391
|
+
dnf_package "chef_rpm" do
|
1392
|
+
options default_options
|
1393
|
+
action :remove
|
1394
|
+
end.should_be_updated
|
1119
1395
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1120
|
-
dnf_package
|
1121
|
-
|
1396
|
+
dnf_package "chef_rpm" do
|
1397
|
+
options default_options
|
1398
|
+
action :remove
|
1399
|
+
end.should_not_be_updated
|
1122
1400
|
end
|
1123
1401
|
|
1124
1402
|
it "removes the package if the i686 package is installed", :intel_64bit do
|
1125
1403
|
skip "FIXME: should this be fixed or is the current behavior correct?"
|
1126
1404
|
preinstall("chef_rpm-1.10-1.i686.rpm")
|
1127
|
-
dnf_package
|
1128
|
-
|
1405
|
+
dnf_package "chef_rpm" do
|
1406
|
+
options default_options
|
1407
|
+
action :remove
|
1408
|
+
end.should_be_updated
|
1129
1409
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1130
|
-
dnf_package
|
1131
|
-
|
1410
|
+
dnf_package "chef_rpm" do
|
1411
|
+
options default_options
|
1412
|
+
action :remove
|
1413
|
+
end.should_not_be_updated
|
1132
1414
|
end
|
1133
1415
|
|
1134
1416
|
it "removes the package if the prior version i686 package is installed", :intel_64bit do
|
1135
1417
|
skip "FIXME: should this be fixed or is the current behavior correct?"
|
1136
1418
|
preinstall("chef_rpm-1.2-1.i686.rpm")
|
1137
|
-
dnf_package
|
1138
|
-
|
1419
|
+
dnf_package "chef_rpm" do
|
1420
|
+
options default_options
|
1421
|
+
action :remove
|
1422
|
+
end.should_be_updated
|
1139
1423
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1140
|
-
dnf_package
|
1141
|
-
|
1424
|
+
dnf_package "chef_rpm" do
|
1425
|
+
options default_options
|
1426
|
+
action :remove
|
1427
|
+
end.should_not_be_updated
|
1142
1428
|
end
|
1143
1429
|
end
|
1144
1430
|
|
1145
1431
|
context "with 64-bit arch", :intel_64bit do
|
1146
|
-
let(:package_name) { "chef_rpm.#{pkg_arch}" }
|
1147
1432
|
it "does nothing if the package is not installed" do
|
1148
1433
|
flush_cache
|
1149
|
-
dnf_package
|
1150
|
-
|
1434
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
1435
|
+
options default_options
|
1436
|
+
action :remove
|
1437
|
+
end.should_not_be_updated
|
1151
1438
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1152
1439
|
end
|
1153
1440
|
|
1154
1441
|
it "removes the package if the package is installed" do
|
1155
1442
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
1156
|
-
dnf_package
|
1157
|
-
|
1443
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
1444
|
+
options default_options
|
1445
|
+
action :remove
|
1446
|
+
end.should_be_updated
|
1158
1447
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1159
|
-
dnf_package
|
1160
|
-
|
1448
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
1449
|
+
options default_options
|
1450
|
+
action :remove
|
1451
|
+
end.should_not_be_updated
|
1161
1452
|
end
|
1162
1453
|
|
1163
1454
|
it "removes the package if the prior version package is installed" do
|
1164
1455
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1165
|
-
dnf_package
|
1166
|
-
|
1456
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
1457
|
+
options default_options
|
1458
|
+
action :remove
|
1459
|
+
end.should_be_updated
|
1167
1460
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1168
|
-
dnf_package
|
1169
|
-
|
1461
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
1462
|
+
options default_options
|
1463
|
+
action :remove
|
1464
|
+
end.should_not_be_updated
|
1170
1465
|
end
|
1171
1466
|
|
1172
1467
|
it "does nothing if the i686 package is installed" do
|
1173
1468
|
preinstall("chef_rpm-1.10-1.i686.rpm")
|
1174
|
-
dnf_package
|
1175
|
-
|
1469
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
1470
|
+
options default_options
|
1471
|
+
action :remove
|
1472
|
+
end.should_not_be_updated
|
1176
1473
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
|
1177
1474
|
end
|
1178
1475
|
|
1179
1476
|
it "does nothing if the prior version i686 package is installed" do
|
1180
1477
|
preinstall("chef_rpm-1.2-1.i686.rpm")
|
1181
|
-
dnf_package
|
1182
|
-
|
1478
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
1479
|
+
options default_options
|
1480
|
+
action :remove
|
1481
|
+
end.should_not_be_updated
|
1183
1482
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.i686$")
|
1184
1483
|
end
|
1185
1484
|
end
|
1186
1485
|
|
1187
1486
|
context "with 32-bit arch", :intel_64bit do
|
1188
|
-
let(:package_name) { "chef_rpm.i686" }
|
1189
1487
|
it "removes only the 32-bit arch if both are installed" do
|
1190
1488
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm", "chef_rpm-1.10-1.i686.rpm")
|
1191
|
-
dnf_package.
|
1192
|
-
|
1489
|
+
dnf_package "chef_rpm.i686" do
|
1490
|
+
options default_options
|
1491
|
+
action :remove
|
1492
|
+
end.should_be_updated
|
1193
1493
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
1194
|
-
dnf_package.
|
1195
|
-
|
1494
|
+
dnf_package "chef_rpm.i686" do
|
1495
|
+
options default_options
|
1496
|
+
action :remove
|
1497
|
+
end.should_not_be_updated
|
1196
1498
|
end
|
1197
1499
|
end
|
1198
1500
|
|
@@ -1200,11 +1502,15 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
1200
1502
|
it "works when a package is installed" do
|
1201
1503
|
FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
|
1202
1504
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1203
|
-
dnf_package
|
1204
|
-
|
1505
|
+
dnf_package "chef_rpm" do
|
1506
|
+
options "--nogpgcheck --disablerepo=*"
|
1507
|
+
action :remove
|
1508
|
+
end.should_be_updated
|
1205
1509
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1206
|
-
dnf_package
|
1207
|
-
|
1510
|
+
dnf_package "chef_rpm" do
|
1511
|
+
options "--nogpgcheck --disablerepo=*"
|
1512
|
+
action :remove
|
1513
|
+
end.should_not_be_updated
|
1208
1514
|
end
|
1209
1515
|
end
|
1210
1516
|
end
|
@@ -1220,61 +1526,75 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
1220
1526
|
|
1221
1527
|
it "locks an rpm" do
|
1222
1528
|
flush_cache
|
1223
|
-
dnf_package
|
1224
|
-
|
1225
|
-
|
1529
|
+
dnf_package "chef_rpm" do
|
1530
|
+
options default_options
|
1531
|
+
action :lock
|
1532
|
+
end.should_be_updated
|
1226
1533
|
expect(shell_out("dnf versionlock list").stdout.chomp).to match("^chef_rpm-0:")
|
1227
|
-
dnf_package
|
1228
|
-
|
1534
|
+
dnf_package "chef_rpm" do
|
1535
|
+
options default_options
|
1536
|
+
action :lock
|
1537
|
+
end.should_not_be_updated
|
1229
1538
|
end
|
1230
1539
|
|
1231
1540
|
it "does not lock if its already locked" do
|
1232
1541
|
flush_cache
|
1233
1542
|
shell_out!("dnf versionlock add chef_rpm")
|
1234
|
-
dnf_package
|
1235
|
-
|
1236
|
-
|
1543
|
+
dnf_package "chef_rpm" do
|
1544
|
+
options default_options
|
1545
|
+
action :lock
|
1546
|
+
end.should_not_be_updated
|
1237
1547
|
expect(shell_out("dnf versionlock list").stdout.chomp).to match("^chef_rpm-0:")
|
1238
1548
|
end
|
1239
1549
|
|
1240
1550
|
it "unlocks an rpm" do
|
1241
1551
|
flush_cache
|
1242
1552
|
shell_out!("dnf versionlock add chef_rpm")
|
1243
|
-
dnf_package
|
1244
|
-
|
1245
|
-
|
1553
|
+
dnf_package "chef_rpm" do
|
1554
|
+
options default_options
|
1555
|
+
action :unlock
|
1556
|
+
end.should_be_updated
|
1246
1557
|
expect(shell_out("dnf versionlock list").stdout.chomp).not_to match("^chef_rpm-0:")
|
1247
|
-
dnf_package
|
1248
|
-
|
1558
|
+
dnf_package "chef_rpm" do
|
1559
|
+
options default_options
|
1560
|
+
action :unlock
|
1561
|
+
end.should_not_be_updated
|
1249
1562
|
end
|
1250
1563
|
|
1251
1564
|
it "does not unlock an already locked rpm" do
|
1252
1565
|
flush_cache
|
1253
|
-
dnf_package
|
1254
|
-
|
1255
|
-
|
1566
|
+
dnf_package "chef_rpm" do
|
1567
|
+
options default_options
|
1568
|
+
action :unlock
|
1569
|
+
end.should_not_be_updated
|
1256
1570
|
expect(shell_out("dnf versionlock list").stdout.chomp).not_to match("^chef_rpm-0:")
|
1257
1571
|
end
|
1258
1572
|
|
1259
1573
|
it "check that we can lock based on provides" do
|
1260
1574
|
flush_cache
|
1261
|
-
dnf_package
|
1262
|
-
|
1263
|
-
|
1575
|
+
dnf_package "chef_rpm_provides" do
|
1576
|
+
options default_options
|
1577
|
+
action :lock
|
1578
|
+
end.should_be_updated
|
1264
1579
|
expect(shell_out("dnf versionlock list").stdout.chomp).to match("^chef_rpm-0:")
|
1265
|
-
dnf_package
|
1266
|
-
|
1580
|
+
dnf_package "chef_rpm_provides" do
|
1581
|
+
options default_options
|
1582
|
+
action :lock
|
1583
|
+
end.should_not_be_updated
|
1267
1584
|
end
|
1268
1585
|
|
1269
1586
|
it "check that we can unlock based on provides" do
|
1270
1587
|
flush_cache
|
1271
1588
|
shell_out!("dnf versionlock add chef_rpm")
|
1272
|
-
dnf_package
|
1273
|
-
|
1274
|
-
|
1589
|
+
dnf_package "chef_rpm_provides" do
|
1590
|
+
options default_options
|
1591
|
+
action :unlock
|
1592
|
+
end.should_be_updated
|
1275
1593
|
expect(shell_out("dnf versionlock list").stdout.chomp).not_to match("^chef_rpm-0:")
|
1276
|
-
dnf_package
|
1277
|
-
|
1594
|
+
dnf_package "chef_rpm_provides" do
|
1595
|
+
options default_options
|
1596
|
+
action :unlock
|
1597
|
+
end.should_not_be_updated
|
1278
1598
|
end
|
1279
1599
|
end
|
1280
1600
|
end
|