puppetlabs / puppet_litmus

Providing a simple command line tool for puppet content creators, to enable simple and complex test deployments.
Apache License 2.0
88 stars 56 forks source link

Issues discovered in rake task install_modules_from_directory #246

Closed findmyname666 closed 4 years ago

findmyname666 commented 4 years ago

Describe the Bug

I experienced several bugs in rake task install_modules_from_directory:

bundle exec rake "litmus:install_modules_from_directory[spec/fixtures/modules]"

1) builder variable is used before definition in rake task litmus:install_modules_from_directory - see here.

2) Upload of modules finish successfully even if bolt reports errors in rake task litmus:install_modules_from_directory: Error - bolt cannot connect to container:

upload_file: result [{:target=>"localhost:2222", :action=>nil, :object=>nil, :status=>"failure", :result=>{"_error"=>{"kind"=>"puppetlabs.tasks/connect-error", "msg"=>"Failed to connect to localhost: connection closed by remote host", "details"=>{}, "issue_code"=>"CONNECT_ERROR"}}, :node=>"localhost:2222"}]
  1. bolt for some reason doesn't respect ssh config in inventory.yaml Error with adjusted code with added logging:
    \nInstalling
    uploading and installing module puppetlabs-provision-0.1.0.tar.gz to /tmp/puppetlabs-provision-0.1.0.tar.gz on target(s) ["127.0.0.1:2222"]
    upload_file: uploading file from /home/findmyname/Documents/ops/puppet_ng/pkg/puppetlabs-provision-0.1.0.tar.gz to /tmp/puppetlabs-provision-0.1.0.tar.gz on ["127.0.0.1:2222"]
    upload_file: result [{:target=>"127.0.0.1:2222", :action=>"upload", :object=>"/home/findmyname/Documents/showmax/ops/puppet_ng/pkg/puppetlabs-provision-0.1.0.tar.gz", :status=>"success", :result=>{"_output"=>"Uploaded '/home/findmyname/Documents/ops/puppet_ng/pkg/puppetlabs-provision-0.1.0.tar.gz' to '127.0.0.1:/tmp/puppetlabs-provision-0.1.0.tar.gz'"}, :node=>"127.0.0.1:2222"}]
    rake aborted!
    Installation of package puppetlabs-provision-0.1.0.tar.gz failed. Errors per target: {"127.0.0.1:2222"=>"Authentication failed for user findmyname@127.0.0.1"}

    It can be fixed when we set SSH config in Bolt config and we pass Bolt config to function run_command but it doesn't seems to be right ...

    Expected Behavior

    1) I expect that it should work :) 2) Task should fail when upload of modules fail :) 3) Bolt should use SSH config from inventory.

Steps to Reproduce

Steps to reproduce the behavior:

  1. run task bundle exec rake "litmus:install_modules_from_directory[spec/fixtures/modules]"
  2. wait for fail :)

Environment

activesupport (6.0.2.1, 5.2.4.1, 5.2.4, 5.2.3, 5.1.7) addressable (2.7.0, 2.4.0) ansi (1.5.0) ast (2.4.0) aws-eventstream (1.0.3) aws-partitions (1.274.0, 1.273.0, 1.272.0, 1.269.0, 1.254.0) aws-sdk-core (3.90.1, 3.89.1, 3.85.1) aws-sdk-ec2 (1.144.0, 1.143.0, 1.141.0, 1.137.0, 1.124.0) aws-sigv4 (1.1.0) backports (3.16.0) backticks (1.0.2) bcrypt_pbkdf (1.0.1) beaker (4.16.0) beaker-abs (0.5.0) beaker-answers (0.27.0) beaker-docker (0.7.0) beaker-hostgenerator (1.2.2) beaker-module_install_helper (0.1.7) beaker-pe (2.11.1) beaker-puppet (1.18.13) beaker-puppet_install_helper (0.9.8) beaker-rspec (6.2.4) beaker-vmpooler (1.3.3) bigdecimal (default: 1.3.4) bindata (2.4.4) blockenspiel (0.5.0) bolt (1.49.0, 1.47.0, 1.38.0) builder (3.2.4) bundler (default: 1.16.6) bundler-unload (1.0.2) byebug (11.1.1) CFPropertyList (2.3.6) childprocess (3.0.0, 0.7.1) cmath (default: 1.0.0) codecov (0.1.16) coderay (1.1.2) colored (1.2) colored2 (3.1.2) concurrent-ruby (1.1.6, 1.1.5) connection_pool (2.2.2) coveralls (0.8.23) cri (2.15.6) csv (default: 1.0.0) date (default: 1.0.0) dbm (default: 1.0.0) deep_merge (1.2.1) dependency_checker (0.2.0) did_you_mean (1.2.0) diff-lcs (1.3) docile (1.3.2) docker-api (1.34.2) domain_name (0.5.20190701, 0.5.20180417, 0.5.20170404) equatable (0.6.1, 0.5.0) erubi (1.9.0) etc (default: 1.0.0) ethon (0.12.0) excon (0.72.0, 0.71.0) executable-hooks (1.6.0) facter (2.5.7, 2.5.6, 2.5.1) facterdb (1.2.0, 1.0.0, 0.8.2) faraday (0.17.3, 0.15.4, 0.14.0) faraday-http-cache (2.0.0) faraday_middleware (0.14.0, 0.13.1, 0.12.2) fast_gettext (1.8.0, 1.1.2) fcntl (default: 1.0.0) ffi (1.12.2, 1.9.25) ffi-compiler (1.0.1) fiddle (default: 1.0.0) fileutils (default: 1.0.2) formatador (0.2.5) gdbm (default: 2.0.0) gem-wrappers (1.4.0) gettext (3.2.9) gettext-setup (0.34, 0.31) gh (0.15.1) git (1.6.0) gitlab (4.11.0) gssapi (1.3.0) guard (2.16.1) guard-rake (1.0.0) gyoku (1.3.1) hiera (3.6.0, 3.5.0) hiera-eyaml (3.2.0, 3.1.1) hiera-http (1.4.0) highline (1.7.10, 1.6.21) hirb (0.7.3) hitimes (1.3.0, 1.2.6) hocon (1.3.0, 1.2.5) honeycomb-beeline (1.3.0) http (4.3.0) http-accept (1.7.0) http-cookie (1.0.3) http-form_data (2.2.0) http-parser (1.2.1) httparty (0.17.0) httpclient (2.8.3) i18n (1.8.2, 1.7.0, 1.6.0) in-parallel (0.1.17) inifile (3.0.0) iniparse (1.4.4) io-console (default: 0.4.6) ipaddr (default: 1.2.0) jaro_winkler (1.5.2) jgrep (1.5.1) jmespath (1.4.0) json (2.3.0, default: 2.1.0) json-schema (2.8.1, 2.8.0) json_pure (2.1.0) launchy (2.4.3) libhoney (1.14.4) listen (3.2.1) little-plugger (1.1.4) locale (2.1.3, 2.1.2) log4r (1.1.10) logger (1.4.2) logging (2.2.2) lookup_http (1.0.3) lumberjack (1.2.4) metaclass (0.0.4) metadata-json-lint (2.2.0) method_source (0.9.2, 0.8.2) mime-types (3.3.1, 3.3, 3.2.2, 3.1) mime-types-data (3.2019.1009, 3.2019.0331, 3.2016.0521) minitar (0.9) minitest (5.14.0, 5.13.0, 5.11.3, 5.10.3) mocha (1.11.2, 1.11.1, 1.4.0, 1.1.0) multi_json (1.14.1, 1.13.1) multi_xml (0.6.0) multipart-post (2.1.1) necromancer (0.5.1, 0.4.0) nenv (0.3.0) net-http-persistent (3.1.0, 2.9.4) net-http-pipeline (1.0.1) net-scp (1.2.1) net-ssh (5.2.0) net-ssh-krb (0.5.1) net-telnet (0.1.1) netrc (0.11.0) nori (2.6.0) notiffany (0.1.3) octokit (4.16.0) oga (3.2) oj (3.7.12, 3.3.10) onceover (3.15.0) onceover-codequality (0.3.0) open_uri_redirections (0.2.1) openssl (default: 2.1.2) optimist (3.0.0) orchestrator_client (0.4.3) overcommit (0.52.1) parallel (1.19.1, 1.17.0) parallel_tests (2.31.0, 2.14.2) parser (2.7.0.2, 2.6.3.0, 2.5.1.2) pastel (0.7.3, 0.7.2) pathspec (0.2.1) pdk (1.16.0, 1.15.0) power_assert (1.1.1) powerpack (0.1.2) pry (0.12.2, 0.10.4) pry-byebug (3.8.0) psych (3.1.0, default: 3.0.2) public_suffix (4.0.3, 4.0.1) puppet (6.12.0, 6.11.1, 6.4.2) puppet-blacksmith (5.0.0) puppet-lint (2.4.2, 2.3.6) puppet-lint-absolute_classname-check (2.0.0) puppet-lint-anchor-check (1.0.0) puppet-lint-classes_and_types_beginning_with_digits-check (0.1.2) puppet-lint-i18n (1.0.0) puppet-lint-leading_zero-check (0.1.1) puppet-lint-legacy_facts-check (1.0.3) puppet-lint-topscope-variable-check (1.0.1) puppet-lint-trailing_comma-check (0.4.2) puppet-lint-unquoted_string-check (1.0.0) puppet-lint-variable_contains_upcase (1.2.0) puppet-lint-version_comparison-check (0.2.1) puppet-module-posix-default-r2.5 (0.4.2) puppet-module-posix-dev-r2.5 (0.4.2) puppet-resource_api (1.8.7, 1.8.1) puppet-strings (2.3.1, 1.2.1) puppet-syntax (2.6.1, 2.6.0) puppet_forge (2.3.2, 2.3.1) puppet_litmus (0.15.0, 0.14.0, 0.13.1) puppet_pot_generator (1.0.1) puppetlabs_spec_helper (2.14.1) pusher-client (0.6.2) r10k (3.4.0, 3.3.3) rainbow (3.0.0, 2.2.2) rake (13.0.1, 12.3.3, 12.3.0) random-word (1.3.0) rb-fsevent (0.10.3) rb-inotify (0.10.1) rb-readline (0.5.5) rbnacl (7.1.1) rbnacl-libsodium (1.0.16) rchardet (1.8.0) rdoc (default: 6.0.1) redcarpet (3.5.0) require_all (1.3.3) rest-client (2.1.0, 2.0.2) retriable (3.1.2) rgen (0.8.2) rspec (3.9.0) rspec-core (3.9.1, 3.9.0) rspec-expectations (3.9.0) rspec-its (1.3.0) rspec-mocks (3.9.1, 3.9.0) rspec-puppet (2.7.8) rspec-puppet-facts (1.10.0, 1.9.6) rspec-puppet-utils (3.4.0) rspec-support (3.9.2, 3.9.0) rspec_junit_formatter (0.4.1) rsync (1.0.9) rubocop (0.65.0, 0.49.1) rubocop-gitlab-security (0.1.1) rubocop-i18n (1.2.0) rubocop-rspec (1.32.0, 1.16.0, 1.15.1) ruby-ll (2.1.2) ruby-progressbar (1.10.1) ruby_smb (1.1.0) rubygems-bundler (1.4.5) rubyntlm (0.6.2) rubyzip (2.2.0, 2.1.0, 2.0.0) rvm (1.11.3.9) sawyer (0.8.2) scanf (default: 1.0.0) sdbm (default: 1.0.0) semantic_puppet (1.0.2) serverspec (2.41.5) sfl (2.3) shellany (0.0.1) simplecov (0.18.2, 0.18.1, 0.17.1, 0.16.1) simplecov-console (0.6.0, 0.4.2) simplecov-html (0.12.0, 0.11.0, 0.10.2) slop (3.6.0) sm_errors (4.0.0) sm_phabricator (4.2.0) sm_rubocop (7.3.0) spdx-licenses (1.2.0) specinfra (2.82.8, 2.77.1) stringify-hash (0.0.2) stringio (default: 0.0.1) strings-ansi (0.2.0) strscan (default: 1.0.0) sync (0.5.0) table_print (1.5.6) term-ansicolor (1.7.1) terminal-table (1.8.0) test-unit (3.2.7) text (1.3.1) thor (0.20.3) thread_safe (0.3.6) timers (4.1.2) tins (1.24.0) travis (1.8.10) travis-lint (2.0.0) tty-color (0.5.1, 0.5.0, 0.4.2) tty-cursor (0.7.1, 0.7.0, 0.5.0) tty-prompt (0.20.0, 0.16.0) tty-reader (0.7.0, 0.2.0) tty-screen (0.7.1, 0.7.0, 0.6.4) tty-spinner (0.9.3, 0.9.2) tty-which (0.4.2, 0.4.1) typhoeus (0.8.0) tzinfo (1.2.6, 1.2.5) unf (0.1.4) unf_ext (0.0.7.6, 0.0.7.4) unicode-display_width (1.6.1, 1.6.0, 1.4.1) unicode_utils (1.4.0) url (0.3.2) versionomy (0.5.0) voxpupuli-release (1.0.1) webrick (default: 1.4.2) websocket (1.2.8) windows_error (0.1.2) winrm (2.3.4, 2.3.3) winrm-fs (1.3.4) wisper (2.0.1, 2.0.0) xmlrpc (0.3.0) yard (0.9.24, 0.9.20) zeitwerk (2.2.2) zlib (default: 1.0.0)

michaeltlombardi commented 4 years ago

The root of this problem is in puppetlabs/bolt#1614, where the inventory_hash is altered during a run.

findmyname666 commented 4 years ago

@michaeltlombardi it seems that you totally ignore 2nd point of this issue report. I propose fixes in https://github.com/puppetlabs/puppet_litmus/pull/247/files. Can you take a look pls?

findmyname666 commented 4 years ago

@sheenaajay issues reported here aren't solved. Can you explain why did you close it pls?

michaeltlombardi commented 4 years ago

Whoops! Sorry, @findmyname666, it looks like this was automatically closed on merge because of the wording in my commit message, not an intentional close by Sheena or myself. This should remain open until puppetlabs/bolt#1614 is resolved.

DavidS commented 4 years ago

247 now should have all the fixes for this (and #270)

@findmyname666 would be great if you can confirm the fix in your environment

findmyname666 commented 4 years ago

@DavidS i cannot now ... i decided not to use this modules as it looks messy + it take long time to fix it :(