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

Compilation failed due to check function after apt versioned package installation. #360

Open
takryo00 opened this issue Jun 13, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@takryo00
Copy link

Summary

Compilation failed due to check function to update resource state after installation does not check the version of installed package.
If we configured to install specific version package, compilation failed all time.

Cause

The check function use installed package information from package manager by parse function. The parse function is implemented to take the information of version too, but the check function does not use the version information to check after installation it on completed.

check function

case p.managedPackage.Apt != nil:
desiredState = p.managedPackage.Apt.DesiredState
_, pkgIns = aptInstalled.cache[p.managedPackage.Apt.PackageResource.GetName()]

parse function

func parseInstalledDebpackages(data []byte) []*PkgInfo {

package cache use only "package name"

cache.cache = map[string]struct{}{}
for _, pkg := range pis {
cache.cache[pkg.Name] = struct{}{}
}

Reproduction of failure

  1. create GCE instance with ubuntu 20.04 LT.
  2. create OS Policy with configuration to install version specific nginx.
  3. compilation failed all time.
id: setup-version-specified-nginx
mode: ENFORCEMENT
resourceGroups:
  - osFilter:
      osShortName: ubuntu
    resources:
      - id: install-pkg
        pkg:
          desiredState: INSTALLED
          apt:
            name: "nginx=1.18.0-0ubuntu1.2"
@adjackura adjackura self-assigned this Jun 15, 2021
@adjackura
Copy link
Contributor

Right now we do not support anything but package name for PackageResource, I am looking at the best way to implement making sure a specific version is installed but it will most likely not be by setting the apt version install format and instead a more generic version field.

@adjackura adjackura added the enhancement New feature or request label Jun 15, 2021
@minor-fixes
Copy link

Any updates on the implementation status?

If this is still not implemented, is there a recommended workaround for ensuring a particular version of a package is installed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants