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

Setting install_path on a module in an environment source errors #1288

Closed
SeanHood opened this issue Mar 30, 2022 · 0 comments · Fixed by #1289
Closed

Setting install_path on a module in an environment source errors #1288

SeanHood opened this issue Mar 30, 2022 · 0 comments · Fixed by #1289
Labels

Comments

@SeanHood
Copy link
Contributor

Describe the Bug

When setting an install_path for an "environment source" module it returns an error.

root@310a9d7b4205:/# r10k deploy environment --verbose debug -t
[2022-03-30 15:46:45 - ERROR] undefined method `resolve_install_path' for #<R10K::Environment::Git:0x000055f413f20050>
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/environment/with_modules.rb:114:in `add_module'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/environment/with_modules.rb:102:in `block in load_modules'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/environment/with_modules.rb:97:in `each'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/environment/with_modules.rb:97:in `load_modules'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/environment/with_modules.rb:39:in `initialize'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/environment/git.rb:39:in `initialize'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/keyed_factory.rb:30:in `new'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/keyed_factory.rb:30:in `generate'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/environment.rb:16:in `generate'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/environment.rb:28:in `from_hash'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/source/hash.rb:171:in `block in environments'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/source/hash.rb:170:in `each'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/source/hash.rb:170:in `map'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/source/hash.rb:170:in `environments'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/deployment.rb:87:in `block in validate!'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/deployment.rb:86:in `each'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/deployment.rb:86:in `validate!'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/action/deploy/environment.rb:110:in `visit_deployment'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/action/visitor.rb:27:in `visit'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/deployment.rb:106:in `accept'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/action/deploy/environment.rb:75:in `call'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/action/runner.rb:33:in `call'
/usr/local/bundle/gems/r10k-3.14.2/lib/r10k/action/cri_runner.rb:67:in `call'
/usr/local/bundle/gems/cri-2.15.10/lib/cri/command_dsl.rb:303:in `block in runner'
/usr/local/bundle/gems/cri-2.15.10/lib/cri/command.rb:360:in `run_this'
/usr/local/bundle/gems/cri-2.15.10/lib/cri/command.rb:296:in `run'
/usr/local/bundle/gems/cri-2.15.10/lib/cri/command.rb:314:in `run'
/usr/local/bundle/gems/cri-2.15.10/lib/cri/command.rb:314:in `run'
/usr/local/bundle/gems/r10k-3.14.2/bin/r10k:7:in `<top (required)>'
/usr/local/bundle/bin/r10k:23:in `load'
/usr/local/bundle/bin/r10k:23:in `<main>'

Expected Behavior

I expect the module to be installed in the path specified, without error.

Each module accepts the same arguments accepted by the mod method in a Puppetfile.
Ref: https://github.com/puppetlabs/r10k/blob/main/doc/dynamic-environments/configuration.mkd#environment-modules

In context of the below config:

/tmp/repos
└── production
    ├── ...
    ├── hieradata        <--- I expect my site-data "module" to be placed here
    │   ├── ...
    │   └── common.yaml
    ├── manifests
    │   ├── ...
    │   └── site.pp
    ├── site-modules
    │   ├── profile
    │   └── role
    └── hiera.yaml

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create the following two config files

    # r10k.yaml
    ---
    sources:
      puppet:
        prefix: false
        basedir: /tmp/repos
        config: environments.yaml
        type: yaml
    
    # environments.yaml
    ---
    production:
      type: git
      source: git@github.com:puppetlabs/control-repo.git
      version: master
      modules:
        hieradata:
          type: git
          source: git@git.example.com:site_data.git
          version: master
          install_path: ''
    
  2. Attempt to deploy with r10k: r10k deploy environment --verbose debug -t

Environment

  • Version: 3.14.2
  • Platform: ruby:2.7 docker image (Linux 310a9d7b4205 5.10.47-linuxkit #1 SMP Sat Jul 3 21:51:47 UTC 2021 x86_64 GNU/Linux)
@SeanHood SeanHood added the bug label Mar 30, 2022
SeanHood added a commit to SeanHood/r10k that referenced this issue Mar 30, 2022
Fixes puppetlabs#1288

Using `install_path` on environment modules would error with: `undefined method `resolve_install_path' for #<R10K::Environment::Git:0x000055f413f20050>`

This PR fixes this error, borrowing the similarly named functions from puppetlabs@a153c84
SeanHood added a commit to SeanHood/r10k that referenced this issue Mar 30, 2022
Fixes puppetlabs#1288

Using `install_path` on environment modules would error with: `undefined method `resolve_install_path' for #<R10K::Environment::Git:0x000055f413f20050>`

This PR fixes this error, borrowing the similarly named functions from puppetlabs@a153c84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant