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

require (not contain) yum::plugin::versionlock #154

Merged
merged 1 commit into from
Jan 20, 2020

Conversation

alexjfisher
Copy link
Member

The plugin class yum::plugin::versionlock should not be contained
from every instance of the yum::versionlock defined type. Doing so
makes it impossible to use the type in multiple dependent
classes/profiles. contain implies that the resource 'owns' the plugin.
Using require should be just as effective at solving #43 without
introducing dependency cycles.

With contain...

class profile::foo {
  yum::versionlock { '0:bash-4.1.2-9.el6_2.*':}
}

class profile::bar {
  yum::versionlock { '2:vim-enhanced-7.4.629-6.el7.x86_64':}
}

include profile::foo
include profile::bar

Class['profile::foo'] -> Class['profile::bar']

fails with

Error: Found 1 dependency cycle:
(Augeas[yum.conf_plugins] => Yum::Config[plugins] => Yum::Plugin[versionlock] => Class[Yum::Plugin::Versionlock] => Yum::Versionlock[0:bash-4.1.2-9.el6_2.*] => Class[Profile::Foo] => Class[Profile::Bar] => Yum::Versionlock[2:vim-enhanced-7.4.629-6.el7.x86_64] => Class[Yum::Plugin::Versionlock] => Yum::Plugin[versionlock] => Package[yum-plugin-versionlock] => Yum::Plugin[versionlock])\nTry the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz
Error: Failed to apply catalog: One or more resource dependency cycles detected in graph

This commit also refactors the type with:

  • puppet-strings style docs.
  • A simple unless instead of a case for ensure.
  • assert_type instead of is_a.

Fixes #43

The plugin class `yum::plugin::versionlock` should not be `contain`ed
from every instance of the `yum::versionlock` defined type. Doing so
makes it impossible to use the type in multiple dependent
classes/profiles. `contain` implies that the resource 'owns' the plugin.
Using `require` should be just as effective at solving voxpupuli#43 without
introducing dependency cycles.

With `contain`...

```puppet
class profile::foo {
  yum::versionlock { '0:bash-4.1.2-9.el6_2.*':}
}

class profile::bar {
  yum::versionlock { '2:vim-enhanced-7.4.629-6.el7.x86_64':}
}

include profile::foo
include profile::bar

Class['profile::foo'] -> Class['profile::bar']
```

fails with
```
Error: Found 1 dependency cycle:
(Augeas[yum.conf_plugins] => Yum::Config[plugins] => Yum::Plugin[versionlock] => Class[Yum::Plugin::Versionlock] => Yum::Versionlock[0:bash-4.1.2-9.el6_2.*] => Class[Profile::Foo] => Class[Profile::Bar] => Yum::Versionlock[2:vim-enhanced-7.4.629-6.el7.x86_64] => Class[Yum::Plugin::Versionlock] => Yum::Plugin[versionlock] => Package[yum-plugin-versionlock] => Yum::Plugin[versionlock])\nTry the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz
Error: Failed to apply catalog: One or more resource dependency cycles detected in graph
```

This commit also refactors the type with:
  * puppet-strings style docs.
  * A simple `unless` instead of a `case` for `ensure`.
  * `assert_type` instead of `is_a`.

Fixes voxpupuli#43
@bastelfreak bastelfreak merged commit 942c801 into voxpupuli:master Jan 20, 2020
@bastelfreak bastelfreak added the bug Something isn't working label Jan 20, 2020
@alexjfisher alexjfisher deleted the versionlock_refactor branch October 7, 2020 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

versionlock.list updated after package {} install
3 participants