go2chef icon indicating copy to clipboard operation
go2chef copied to clipboard

PackageName option to install step ineffective

Open kcbraunschweig opened this issue 5 years ago • 2 comments

If using the PackageName option to override the package to install from the default ("chef"), log messages will indicate the specified package is being installed but in reality it still tries to install a package called "chef" anyway. The option is not being respected. (tested on a host using DNF)

kcbraunschweig avatar Oct 01 '20 23:10 kcbraunschweig

I couldn't reproduce the issue reproduce steps:

  1. build binary make darwin
  2. create config file without setting package_name (using default chef package), with random rpm package (not chef)
{
  "loggers": [
    {
      "type": "go2chef.logger.stdlib",
      "name": "stdlib",
      "level": "DEBUG",
      "debugging": 1,
      "verbosity": 1
    }
  ],
  "steps": [
    {
      "type": "go2chef.step.install.linux.dnf",
      "name": "test issue 40",
      "dnf_binary": "/bin/echo",
      "rpm": "/bin/echo",
      "version": "15.2.20-1.el7.x86_64",
      "source": {
        "type": "go2chef.source.http",
        "url": "http://rep-centos-il.upress.io/8/extras/x86_64/os/Packages/cpaste-1.0.0-3.el8.x86_64.rpm"
      }
    }
  ]
}
  1. run go2chef, execution failed because package-name does not match rpm file (line 21)
❯ ./build/darwin/amd64/go2chef --local-config ../00-basic.json

     1	          ___    _         __
     2	 __ _ ___|_  )__| |_  ___ / _|
     3	/ _` / _ \/ // _| ' \/ -_)  _|
     4	\__, \___/___\__|_||_\___|_|
     5	|___/

     6	GO2CHEF 2022/02/03 14:49:34 loading config from source go2chef.config_source.local
     7	GO2CHEF 2022/02/03 14:49:34 EVENT: LOGGING_INITIALIZED in go2chef.cli -
     8	GO2CHEF 2022/02/03 14:49:34 EVENT: LOGGING_INITIALIZED in go2chef.cli -
     9	GO2CHEF 2022/02/03 14:49:34 EVENT: STEP_0_START go2chef.step.install.linux.dnf:'test issue 40' in go2chef.cli -
    10	GO2CHEF 2022/02/03 14:49:34 EVENT: STEP_0_START go2chef.step.install.linux.dnf:'test issue 40' in go2chef.cli -
    11	GO2CHEF 2022/02/03 14:49:34 EVENT: HTTP_DOWNLOAD_STARTED in go2chef.source.http - http://rep-centos-il.upress.io/8/extras/x86_64/os/Packages/cpaste-1.0.0-3.el8.x86_64.rpm
    12	GO2CHEF 2022/02/03 14:49:34 EVENT: HTTP_DOWNLOAD_STARTED in go2chef.source.http - http://rep-centos-il.upress.io/8/extras/x86_64/os/Packages/cpaste-1.0.0-3.el8.x86_64.rpm
    13	GO2CHEF 2022/02/03 14:49:34 DEBUG: /Users/odedp/tmp/go2chef/plugin/source/http/http.go:94::http: 1
    14	GO2CHEF 2022/02/03 14:49:34 DEBUG: /Users/odedp/tmp/go2chef/plugin/source/http/http.go:94::http: 1
    15	GO2CHEF 2022/02/03 14:49:34 DEBUG: /Users/odedp/tmp/go2chef/plugin/source/http/http.go:107::http: HTTP GET http://rep-centos-il.upress.io/8/extras/x86_64/os/Packages/cpaste-1.0.0-3.el8.x86_64.rpm => 200 OK
    16	GO2CHEF 2022/02/03 14:49:34 DEBUG: /Users/odedp/tmp/go2chef/plugin/source/http/http.go:107::http: HTTP GET http://rep-centos-il.upress.io/8/extras/x86_64/os/Packages/cpaste-1.0.0-3.el8.x86_64.rpm => 200 OK
    17	GO2CHEF 2022/02/03 14:49:35 DEBUG: /Users/odedp/tmp/go2chef/plugin/source/http/http.go:179::http: direct download to /var/folders/9q/xh3fyb5x54xbcfm7brtv91tm0000gn/T/go2chef-src-http-977210206, rename to /var/folders/9q/xh3fyb5x54xbcfm7brtv91tm0000gn/T/go2chef-install174550843/cpaste-1.0.0-3.el8.x86_64.rpm
    18	GO2CHEF 2022/02/03 14:49:35 DEBUG: /Users/odedp/tmp/go2chef/plugin/source/http/http.go:179::http: direct download to /var/folders/9q/xh3fyb5x54xbcfm7brtv91tm0000gn/T/go2chef-src-http-977210206, rename to /var/folders/9q/xh3fyb5x54xbcfm7brtv91tm0000gn/T/go2chef-install174550843/cpaste-1.0.0-3.el8.x86_64.rpm
    19	GO2CHEF 2022/02/03 14:49:35 EVENT: HTTP_DOWNLOAD_COMPLETE in go2chef.source.http - http://rep-centos-il.upress.io/8/extras/x86_64/os/Packages/cpaste-1.0.0-3.el8.x86_64.rpm
    20	GO2CHEF 2022/02/03 14:49:35 EVENT: HTTP_DOWNLOAD_COMPLETE in go2chef.source.http - http://rep-centos-il.upress.io/8/extras/x86_64/os/Packages/cpaste-1.0.0-3.el8.x86_64.rpm
    21	GO2CHEF 2022/02/03 14:49:35 DEBUG: /Users/odedp/tmp/go2chef/plugin/step/install/linux/dnf/dnf.go:192::searching for RPM in /var/folders/9q/xh3fyb5x54xbcfm7brtv91tm0000gn/T/go2chef-install174550843 matching ^chef-.*.rpm$
    22	GO2CHEF 2022/02/03 14:49:35 ERROR: /Users/odedp/tmp/go2chef/plugin/step/install/linux/dnf/dnf.go:121::step execution failed: could not find step RPM from http
    23	GO2CHEF 2022/02/03 14:49:35 ERROR: /Users/odedp/tmp/go2chef/plugin/step/install/linux/dnf/dnf.go:121::step execution failed: could not find step RPM from http
    24	GO2CHEF 2022/02/03 14:49:35 EVENT: STEP_0_FAILURE go2chef.step.install.linux.dnf:'test issue 40' in go2chef.cli - file does not exist
    25	GO2CHEF 2022/02/03 14:49:35 EVENT: STEP_0_FAILURE go2chef.step.install.linux.dnf:'test issue 40' in go2chef.cli - file does not exist
    26	2022/02/03 14:49:35 temp dirs cleanup completed
  1. edit config and add package-name that matches the rpm (cpaste)
{
  "loggers": [
    {
      "type": "go2chef.logger.stdlib",
      "name": "stdlib",
      "level": "DEBUG",
      "debugging": 1,
      "verbosity": 1
    }
  ],
  "steps": [
    {
      "type": "go2chef.step.install.linux.dnf",
      "name": "test issue 40",
      "package_name": "cpaste",
      "dnf_binary": "/bin/echo",
      "rpm": "/bin/echo",
      "version": "15.2.20-1.el7.x86_64",
      "source": {
        "type": "go2chef.source.http",
        "url": "http://rep-centos-il.upress.io/8/extras/x86_64/os/Packages/cpaste-1.0.0-3.el8.x86_64.rpm"
      }
    }
  ]
}
  1. execution completed successfully
❯ ./build/darwin/amd64/go2chef --local-config ../00-basic.json

     1	          ___    _         __
     2	 __ _ ___|_  )__| |_  ___ / _|
     3	/ _` / _ \/ // _| ' \/ -_)  _|
     4	\__, \___/___\__|_||_\___|_|
     5	|___/

     6	GO2CHEF 2022/02/03 14:52:11 loading config from source go2chef.config_source.local
     7	GO2CHEF 2022/02/03 14:52:11 EVENT: LOGGING_INITIALIZED in go2chef.cli -
     8	GO2CHEF 2022/02/03 14:52:11 EVENT: LOGGING_INITIALIZED in go2chef.cli -
     9	GO2CHEF 2022/02/03 14:52:11 EVENT: STEP_0_START go2chef.step.install.linux.dnf:'test issue 40' in go2chef.cli -
    10	GO2CHEF 2022/02/03 14:52:11 EVENT: STEP_0_START go2chef.step.install.linux.dnf:'test issue 40' in go2chef.cli -
    11	GO2CHEF 2022/02/03 14:52:11 EVENT: HTTP_DOWNLOAD_STARTED in go2chef.source.http - http://rep-centos-il.upress.io/8/extras/x86_64/os/Packages/cpaste-1.0.0-3.el8.x86_64.rpm
    12	GO2CHEF 2022/02/03 14:52:11 EVENT: HTTP_DOWNLOAD_STARTED in go2chef.source.http - http://rep-centos-il.upress.io/8/extras/x86_64/os/Packages/cpaste-1.0.0-3.el8.x86_64.rpm
    13	GO2CHEF 2022/02/03 14:52:11 DEBUG: /Users/odedp/tmp/go2chef/plugin/source/http/http.go:94::http: 1
    14	GO2CHEF 2022/02/03 14:52:11 DEBUG: /Users/odedp/tmp/go2chef/plugin/source/http/http.go:94::http: 1
    15	GO2CHEF 2022/02/03 14:52:12 DEBUG: /Users/odedp/tmp/go2chef/plugin/source/http/http.go:107::http: HTTP GET http://rep-centos-il.upress.io/8/extras/x86_64/os/Packages/cpaste-1.0.0-3.el8.x86_64.rpm => 200 OK
    16	GO2CHEF 2022/02/03 14:52:12 DEBUG: /Users/odedp/tmp/go2chef/plugin/source/http/http.go:107::http: HTTP GET http://rep-centos-il.upress.io/8/extras/x86_64/os/Packages/cpaste-1.0.0-3.el8.x86_64.rpm => 200 OK
    17	GO2CHEF 2022/02/03 14:52:12 DEBUG: /Users/odedp/tmp/go2chef/plugin/source/http/http.go:179::http: direct download to /var/folders/9q/xh3fyb5x54xbcfm7brtv91tm0000gn/T/go2chef-src-http-717464014, rename to /var/folders/9q/xh3fyb5x54xbcfm7brtv91tm0000gn/T/go2chef-install982182251/cpaste-1.0.0-3.el8.x86_64.rpm
    18	GO2CHEF 2022/02/03 14:52:12 DEBUG: /Users/odedp/tmp/go2chef/plugin/source/http/http.go:179::http: direct download to /var/folders/9q/xh3fyb5x54xbcfm7brtv91tm0000gn/T/go2chef-src-http-717464014, rename to /var/folders/9q/xh3fyb5x54xbcfm7brtv91tm0000gn/T/go2chef-install982182251/cpaste-1.0.0-3.el8.x86_64.rpm
    19	GO2CHEF 2022/02/03 14:52:12 EVENT: HTTP_DOWNLOAD_COMPLETE in go2chef.source.http - http://rep-centos-il.upress.io/8/extras/x86_64/os/Packages/cpaste-1.0.0-3.el8.x86_64.rpm
    20	GO2CHEF 2022/02/03 14:52:12 EVENT: HTTP_DOWNLOAD_COMPLETE in go2chef.source.http - http://rep-centos-il.upress.io/8/extras/x86_64/os/Packages/cpaste-1.0.0-3.el8.x86_64.rpm
    21	GO2CHEF 2022/02/03 14:52:12 DEBUG: /Users/odedp/tmp/go2chef/plugin/step/install/linux/dnf/dnf.go:192::searching for RPM in /var/folders/9q/xh3fyb5x54xbcfm7brtv91tm0000gn/T/go2chef-install982182251 matching ^cpaste-.*.rpm$
    22	-y install /var/folders/9q/xh3fyb5x54xbcfm7brtv91tm0000gn/T/go2chef-install982182251/cpaste-1.0.0-3.el8.x86_64.rpm
    23	GO2CHEF 2022/02/03 14:52:12 EVENT: STEP_0_COMPLETE go2chef.step.install.linux.dnf:'test issue 40' in go2chef.cli - completed successfully in 0 second(s)
    24	GO2CHEF 2022/02/03 14:52:12 EVENT: STEP_0_COMPLETE go2chef.step.install.linux.dnf:'test issue 40' in go2chef.cli - completed successfully in 0 second(s)
    25	GO2CHEF 2022/02/03 14:52:12 EVENT: ALL_STEPS_COMPLETE in go2chef.cli - 1 step(s) completed successfully in 0 second(s)
    26	GO2CHEF 2022/02/03 14:52:12 EVENT: ALL_STEPS_COMPLETE in go2chef.cli - 1 step(s) completed successfully in 0 second(s)
    27	2022/02/03 14:52:12 temp dirs cleanup completed

onporat avatar Feb 03 '22 12:02 onporat

I think the options are inconsistent here. I am seeing similar behaviour with Version in https://github.com/facebookincubator/go2chef/issues/52

nishchintraina avatar Jun 09 '22 03:06 nishchintraina