Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Issue] go2chef.step.install.linux.dnf doesn't treat Version consistently #52

Open
nishchintraina opened this issue Jun 8, 2022 · 0 comments

Comments

@nishchintraina
Copy link

I am presently using go2chef.step.install.linux.dnf to install a package and version and relying on dnf to figure out the repo. But I am seeing inconsistency with how go2chef is honoring the "version" value.

go2chef doesn't honor version when the package is not installed at all.
go2chef does honor version when the package is already installed
go2chef doesn't downgrade the package if the version is installed

Repro:

########## Go2chef config ########## 

[centos@ip-172-16-1-244 ~]$ cat /etc/go2chef.config-broken.json
{
  "steps": [
    {
      "type": "go2chef.step.install.linux.dnf",
      "name": "install chef-13",
      "version": "13.10.0-1.el7",
      "package_name": "chef"
    }
  ]
}

########## Remove installed chef ##########
[centos@ip-172-16-1-244 ~]$ sudo dnf remove chef -y
Dependencies resolved.
================================================================================================================================================================================================================================================================================================================================================================================================================================
 Package                                                                                                   Architecture                                                                                  Version                                                                                                 Repository                                                                                                Size
================================================================================================================================================================================================================================================================================================================================================================================================================================
Removing:
 chef                                                                                                      x86_64                                                                                        14.15.6-1.el7                                                                                           @fb-site-packages                                                                                        108 M
Removing dependent packages:
 fb-chef-solo-tools                                                                                        noarch                                                                                        20220503-100441                                                                                         @any-noarch                                                                                              131 k

Transaction Summary
================================================================================================================================================================================================================================================================================================================================================================================================================================
Remove  2 Packages

Freed space: 108 M
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                                                                                                                                                                                                        1/1
  Erasing          : fb-chef-solo-tools-20220503-100441.noarch                                                                                                                                                                                                                                                                                                                                                              1/2
  Erasing          : chef-14.15.6-1.el7.x86_64                                                                                                                                                                                                                                                                                                                                                                              2/2
  Running scriptlet: chef-14.15.6-1.el7.x86_64                                                                                                                                                                                                                                                                                                                                                                              2/2
  Verifying        : chef-14.15.6-1.el7.x86_64                                                                                                                                                                                                                                                                                                                                                                              1/2
  Verifying        : fb-chef-solo-tools-20220503-100441.noarch                                                                                                                                                                                                                                                                                                                                                              2/2

Removed:
  chef-14.15.6-1.el7.x86_64                                                                                                                                                                              fb-chef-solo-tools-20220503-100441.noarch

Complete!
[centos@ip-172-16-1-244 ~]$ rpm -qa | grep ^chef-
[centos@ip-172-16-1-244 ~]$

##########  Run go2chef - doesn't honour version ########## 

[centos@ip-172-16-1-244 ~]$
[centos@ip-172-16-1-244 ~]$ sudo /usr/local/bin/go2chef --local-config /etc/go2chef.config-broken.json

          ___    _         __
 __ _ ___|_  )__| |_  ___ / _|
/ _` / _ \/ // _| ' \/ -_)  _|
\__, \___/___\__|_||_\___|_|
|___/

GO2CHEF 2022/06/08 21:27:34 loading config from source go2chef.config_source.local
GO2CHEF 2022/06/08 21:27:34 EVENT: LOGGING_INITIALIZED in go2chef.cli -
GO2CHEF 2022/06/08 21:27:34 EVENT: STEP_0_START go2chef.step.install.linux.dnf:'install chef-13' in go2chef.cli -
Last metadata expiration check: 0:42:16 ago on Wed 08 Jun 2022 08:45:19 PM UTC.
Dependencies resolved.
================================================================================================================================================================================================================================================================================================================================================================================================================================
 Package                                                                                         Architecture                                                                                      Version                                                                                                    Repository                                                                                                   Size
================================================================================================================================================================================================================================================================================================================================================================================================================================
Installing:
 chef                                                                                            x86_64                                                                                            14.15.6-1.el7                                                                                              fb-site-packages                                                                                             28 M

Transaction Summary
================================================================================================================================================================================================================================================================================================================================================================================================================================
Install  1 Package

Total download size: 28 M
Installed size: 108 M
Downloading Packages:
chef-14.15.6-1.el7.x86_64.rpm                                                                                                                                                                                                                                                                                                                                                                    30 MB/s |  28 MB     00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                                                                                                                                                                            30 MB/s |  28 MB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                                                                                                                                                                                                        1/1
  Installing       : chef-14.15.6-1.el7.x86_64                                                                                                                                                                                                                                                                                                                                                                              1/1
  Running scriptlet: chef-14.15.6-1.el7.x86_64                                                                                                                                                                                                                                                                                                                                                                              1/1
Thank you for installing Chef Infra Client! For help getting started visit https://learn.chef.io

  Verifying        : chef-14.15.6-1.el7.x86_64                                                                                                                                                                                                                                                                                                                                                                              1/1

Installed:
  chef-14.15.6-1.el7.x86_64

Complete!
GO2CHEF 2022/06/08 21:27:43 EVENT: STEP_0_COMPLETE go2chef.step.install.linux.dnf:'install chef-13' in go2chef.cli - completed successfully in 8 second(s)
GO2CHEF 2022/06/08 21:27:43 EVENT: ALL_STEPS_COMPLETE in go2chef.cli - 1 step(s) completed successfully in 8 second(s)
2022/06/08 21:27:43 temp dirs cleanup completed
[centos@ip-172-16-1-244 ~]$ rpm -qa | grep ^chef-
chef-14.15.6-1.el7.x86_64

##########  Install the desired chef version ##########
 
[centos@ip-172-16-1-244 ~]$ sudo dnf install chef-13.10.0-1.el7  -y

Last metadata expiration check: 0:44:26 ago on Wed 08 Jun 2022 08:45:19 PM UTC.
Dependencies resolved.
================================================================================================================================================================================================================================================================================================================================================================================================================================
 Package                                                                                         Architecture                                                                                      Version                                                                                                     Repository                                                                                                  Size
================================================================================================================================================================================================================================================================================================================================================================================================================================
Downgrading:
 chef                                                                                            x86_64                                                                                            13.10.0-1.el7                                                                                               cloud-common-64                                                                                             49 M

Transaction Summary
================================================================================================================================================================================================================================================================================================================================================================================================================================
Downgrade  1 Package

Total download size: 49 M
Downloading Packages:
chef-13.10.0-1.el7.x86_64.rpm                                                                                                                                                                                                                                                                                                                                                                    31 MB/s |  49 MB     00:01
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                                                                                                                                                                            31 MB/s |  49 MB     00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                                                                                                                                                                                                        1/1
  Downgrading      : chef-13.10.0-1.el7.x86_64                                                                                                                                                                                                                                                                                                                                                                              1/2
  Running scriptlet: chef-13.10.0-1.el7.x86_64                                                                                                                                                                                                                                                                                                                                                                              1/2
Thank you for installing Chef!

  Cleanup          : chef-14.15.6-1.el7.x86_64                                                                                                                                                                                                                                                                                                                                                                              2/2
  Running scriptlet: chef-14.15.6-1.el7.x86_64                                                                                                                                                                                                                                                                                                                                                                              2/2
  Verifying        : chef-13.10.0-1.el7.x86_64                                                                                                                                                                                                                                                                                                                                                                              1/2
  Verifying        : chef-14.15.6-1.el7.x86_64                                                                                                                                                                                                                                                                                                                                                                              2/2

Downgraded:
  chef-13.10.0-1.el7.x86_64

Complete!

##########  Run go2chef again - this time it parses the right version and honors it! ########## 


[centos@ip-172-16-1-244 ~]$ sudo /usr/local/bin/go2chef --local-config /etc/go2chef.config-broken.json

          ___    _         __
 __ _ ___|_  )__| |_  ___ / _|
/ _` / _ \/ // _| ' \/ -_)  _|
\__, \___/___\__|_||_\___|_|
|___/

GO2CHEF 2022/06/08 21:30:30 loading config from source go2chef.config_source.local
GO2CHEF 2022/06/08 21:30:30 EVENT: LOGGING_INITIALIZED in go2chef.cli -
GO2CHEF 2022/06/08 21:30:30 EVENT: STEP_0_START go2chef.step.install.linux.dnf:'install chef-13' in go2chef.cli -
GO2CHEF 2022/06/08 21:30:30 INFO: third-party-source/go/github.com/facebookincubator/go2chef/plugin/step/install/linux/dnf/dnf.go:204::Package is already installed: chef-13.10.0-1.el7.x86_64, requested ^chef-13.10.0-1.el7.*
GO2CHEF 2022/06/08 21:30:30 INFO: third-party-source/go/github.com/facebookincubator/go2chef/plugin/step/install/linux/dnf/dnf.go:132::chef specified is already installed, not reinstalling
GO2CHEF 2022/06/08 21:30:30 EVENT: STEP_0_COMPLETE go2chef.step.install.linux.dnf:'install chef-13' in go2chef.cli - completed successfully in 0 second(s)
GO2CHEF 2022/06/08 21:30:30 EVENT: ALL_STEPS_COMPLETE in go2chef.cli - 1 step(s) completed successfully in 0 second(s)
2022/06/08 21:30:30 temp dirs cleanup completed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant