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

[BUG] Relative includes cannot be used for sls requisites #41

Closed
myii opened this issue Jun 4, 2020 · 6 comments · Fixed by myii/ssf-formula#218 or #42
Closed

[BUG] Relative includes cannot be used for sls requisites #41

myii opened this issue Jun 4, 2020 · 6 comments · Fixed by myii/ssf-formula#218 or #42

Comments

@myii
Copy link
Member

myii commented Jun 4, 2020

Your setup

Formula commit hash / release tag

Latest: f4cdc94.

Versions reports (master & minion)

(Travis).

Pillar / config used

https://github.com/saltstack-formulas/packages-formula/blob/7495961d5219306e8d3d5e021acc9e9230eb6eba/test/salt/pillar/ubuntu.sls#L4-L9

# Dependency (golang)
golang:
  pkg:
    name: golang
    use_upstream_repo: false
    use_upstream_archive: false

Bug details

Describe the bug

https://travis-ci.org/github/myii/packages-formula/jobs/694412318#L4276-L4282

                 ID: golang-package-install-pkg-installed
           Function: pkg.installed
               Name: golang
             Result: False
            Comment: The following requisites were not found:
                                 require:
                                     sls: .repo

Steps to reproduce the bug

(Travis run for the packages-formula).

Expected behaviour

No error.

Attempts to fix the bug

@noelmcloughlin This is based on an upstream bug in Salt as discussed here: saltstack-formulas/template-formula#48 (comment).

It's a shame that relative includes (i.e. .install) can't be used when settings a requisite based on an sls -- this is an upstream bug that still hasn't been resolved.

This is the offending line that needs to be fixed:

{%- set sls_repo_install = '.repo' %}

The solution is the same as is used in the template-formula, i.e. probably:

{%- set sls_repo_install = tplroot ~ '.package.repo.install' %}

Furthermore, there really needs to be a test suite for package-based installations -- all are archive-based at the moment.

Additional context

@myii myii added the bug label Jun 4, 2020
@myii
Copy link
Member Author

myii commented Jun 4, 2020

@noelmcloughlin Actually, there's an additional problem here, use_upstream_repo: false is no longer respected, i.e.:

golang:
  pkg:
    use_upstream_repo: false

It was removed here in a recent commit: 8a9b380#diff-e697bcf6a8534d9757121c1934dd6148L8.

@myii
Copy link
Member Author

myii commented Jun 4, 2020

In attempting to fix this, also hitting another bug which seems to be introduced recently:

       local:
           Data failed to compile:
       ----------
           Rendering SLS 'base:golang.config.environ' failed: Jinja variable 'dict object' has no attribute 'path'

Only available if golang.pkg.use_upstream_archive?

{%- do golang.update({'path': golang.pkg.archive.name}) %}


UPDATE: Workaround is to set golang.path: '' in defaults.yaml.

@myii
Copy link
Member Author

myii commented Jun 4, 2020

Even with the correct sls reference, I've hit the following error:

                 ID: golang-package-install-pkg-installed
           Function: pkg.installed
               Name: golang
             Result: False
            Comment: The following requisites were not found:
                                 require:
                                     sls: golang.package.repo.install

Because golang.package.repo.install is empty when golang.pkg.use_upstream_repo: false. I've resolved it locally by moving the Jinja if back into golang/package/install.sls -- in both places, unfortunately.

myii added a commit to myii/golang-formula that referenced this issue Jun 4, 2020
@myii
Copy link
Member Author

myii commented Jun 4, 2020

I've got a fix in place for this, all states passing, just the tests for opensuse and arch need a tiny adjustment:

@myii
Copy link
Member Author

myii commented Jun 4, 2020

myii added a commit to myii/ssf-formula that referenced this issue Jun 4, 2020
myii added a commit to myii/golang-formula that referenced this issue Jun 4, 2020
@myii myii closed this as completed in #42 Jun 5, 2020
saltstack-formulas-travis pushed a commit that referenced this issue Jun 5, 2020
## [0.7.2](v0.7.1...v0.7.2) (2020-06-05)

### Bug Fixes

* **defaults:** ensure `path` is set (for package-based installation) ([e7e088b](e7e088b))
* **pkg:** use correct package name per `osfamily` ([2677e84](2677e84))
* **repo:** fix relative includes cannot be used for `sls` requisites ([6049382](6049382)), closes [#41](#41)

### Continuous Integration

* **kitchen+travis+inspec:** add `package` suite ([aba6e4c](aba6e4c))
@saltstack-formulas-travis

🎉 This issue has been resolved in version 0.7.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants