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

Major update #9

Closed
wants to merge 2 commits into from
Closed

Major update #9

wants to merge 2 commits into from

Conversation

reidmv
Copy link
Member

@reidmv reidmv commented Sep 21, 2015

This PR is a proposed refactor and major version update. This would be released as a new major version.

  • Switch to Puppet 4
    • Use type features for validation, eliminating dependency on puppetlabs/stdlib.
    • Use iteration in dotnet::install::package utility type
    • Use new $::os fact
  • Switch from puppet/download_file to lwf/remote_file. Per commit message in 4db8e15, primary benefit is cleaner implementation allowing for more reliable notify/subscribe. Especially when reboots are subscribed to a dotnet resource this can be important.
  • Switch from exec-based package installation to package resource.
    • Makes it easier to see what dotnet is doing in the graph
    • Makes the code cleaner

@liamjbennett
Copy link
Member

I really like some of these changes so thank you.
I want to give this a more detailed review but initially I have some questions:

  1. Why the use of the remote_file dependency Why this over download_file, archive or staging?
  2. Why the switch to Puppet 4 already?

@reidmv
Copy link
Member Author

reidmv commented Sep 21, 2015

Hi Liam,

Excellent questions! I figured I'd start with the PR as far forward as I already took it for my project use, and if necessary whittle things down based on the code review. With that background, here is my rationale for using remote_file and Puppet 4:

  1. Archive has client-side dependencies and so is what I would consider heavyweight; in addition to that there's no need to extract anything here. Staging has the same problem as download_file. That problem for me is that I'm setting up a reboot resource subscribed to e.g. Dotnet['.NET Framework 4.0'], and during development I ran into a situation where the source EXE didn't need to be downloaded nor .NET installed, but a private administrative resource (this file) in download_file got changed, thus triggering a reboot. Remote_file is a native type that doesn't have administrative fragments that could generate extra events. That reduces the surface area for unnecessary resource changes, thus lowering the chances of accidentally notifying something (like a reboot) down the line. Since I was proposing a major revision anyway it made sense to suggest it now. There's also the nifty side-benefit of remote_file being platform agnostic.

  2. The simple answer is I mostly write Puppet 4 / future parser code these days. When thinking about how to deal with specifying multiple versions of .NET which don't technically co-exist I ended up using iteration here. With that toehold I went ahead and added type checking as well, allowing the removal of the stdlib dependency. As long as I was removing dependencies I figured using the $::os fact would be a good idea too instead of the windowsfacts-provided $::operatingsystemversion so that the dependencies could be slimmed down that much more as well. On $::os I can have high confidence that the version of Facter shipping with Puppet 4 provides it due to the way Puppet Labs is packaging universal single packages for most platforms starting with Puppet 4.

The switch to Puppet 4 is of course what would necessitate making this a new major version.

@nibalizer
Copy link
Member

From a code mgmt perspective I suggest this. Ideally it could/would apply to every module in p-c.

Cutover:

  1. Branch currrent master to 1.x
  2. Merge this PR to master
  3. Add a Box such as https://github.com/puppetlabs/puppetlabs-stdlib#version-compatibility to the README explaining which versions of the module are compatible with which puppet versions.
  4. Release 2.0.0 of the module to the forge
  5. Release the tip of 1.x to the forge as 1.1.whatever if it has been long enough since the last 1.x release.

Ongoing:

  • New features should land on 2.x.
  • Bugfixes and backports can land on 1.x, but only when things seem super broken and important. We should strive to help the consumers move to puppet4.
  • Releases of the 2.x line can continue as normal.
  • Releases of the 1.x.z line (probably .z bugfix releases) can be released at any time. I'm personally okay with releasing after every PR since there shouldn't be many of them and we'd only get that PR if someone was in a rough spot to begin with.
  • At some point in the future we'll depreciate all puppet3 compatibility.

@liamjbennett
Copy link
Member

Ok, I am happy for this change to go ahead and I will do all the required stuff to release a new major version on this.

@reidmv can you fix the tests first on this? Thanks.

@reidmv
Copy link
Member Author

reidmv commented Sep 28, 2015

I can, but not soon. I'm pretty swamped until the end of October. If I get a chance to slip in more work on this before then I will. I'll post an update by October 27.

@nibalizer
Copy link
Member

I'm trying to get the tests passing in #10

@reidmv
Copy link
Member Author

reidmv commented Nov 7, 2015

@liamjbennett @nibalizer tests cleaned up and PR rebased. Ready for review.

/^Windows (XP|Vista|7|8|8.1).*/: { $type = 'package' }
default: { $type = 'err' err("dotnet ${version} is not support on this version of windows") }
case $windows_version {
/^2008/, /^2012/: { $type = 'feature' }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Windows server 2008 (non R2), dotnet 3.5 is a package.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vincent-aguillaume - I've added a commit to fix the error.

@reidmv
Copy link
Member Author

reidmv commented Nov 30, 2015

@liamjbennett @nibalizer bump

@jyaworski
Copy link
Member

Hello:

What's the status of this PR? Can it be rebased and squashed?

@reidmv
Copy link
Member Author

reidmv commented Jan 26, 2016

Rebased and squashed.

Note: tests are breaking due to bug, rodjek/rspec-puppet#361. Not sure what to do about that. Works with rspec-puppet 2.3.0

@liamjbennett
Copy link
Member

@reidmv can you update to rspec-puppet 2.3.2 and try again?

@reidmv reidmv force-pushed the update branch 2 times, most recently from 2ddda63 to ae4c4a4 Compare February 8, 2016 19:34
@reidmv
Copy link
Member Author

reidmv commented Feb 8, 2016

@liamjbennett seems to work! Needed to do style cleanup for rubocop to get that to pass, but the Travis build is green now.

@jyaworski
Copy link
Member

Can this be squashed?

@reidmv
Copy link
Member Author

reidmv commented Feb 16, 2016

@jyaworski squashed.

@reidmv
Copy link
Member Author

reidmv commented Feb 17, 2016

Now modified (and squashed) to comply with strict variables.

@@ -16,7 +16,7 @@ source 'https://rubygems.org'

group :test do
gem 'rake'
gem 'puppet', ENV['PUPPET_VERSION'] || '~> 3.8.0'
gem 'puppet', ENV['PUPPET_VERSION'] || '~> 4.0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jyaworski This PR is proposing a major version update, and uses Puppet 4 language features. Therefore it is not compatible with any version of Puppet <4.0. I wrote a little more about that here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Gemfile is (or will be) managed by modulesync.

https://github.com/voxpupuli/modulesync_config

Please raise a PR over there about it, or this will get overwritten the next time we sync.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added an issue. voxpupuli/modulesync_config#102.

@reidmv reidmv force-pushed the update branch 5 times, most recently from c96d57a to ab9392f Compare March 25, 2016 18:26
@reidmv
Copy link
Member Author

reidmv commented Mar 25, 2016

@jyaworski PR refactored to take modulesync into account.

@bastelfreak
Copy link
Member

Hi @reidmv @liamjbennett, how is it planned to process here? @liamjbennett do you want to do the release (we should do another modulesync before that)?

@liamjbennett
Copy link
Member

liamjbennett commented Jun 5, 2016

Yes I want this to be merged into master. I am not in a position to do the release myself at the moment but if someone else can prepare it on my behalf it would be greatly appreciated.

@bastelfreak
Copy link
Member

@liamjbennett can we talk about the further steps on IRC? I'm currently doing a modulesync in #20, I would like to release the module in the next week.

@reidmv reidmv force-pushed the update branch 3 times, most recently from ec63307 to 80ab699 Compare September 13, 2016 20:37
Previously a Powershell exec was used to install packages. This commit
converts that task to a package-based resource. It allows cleaner,
easier to read code.

Switch from download_file to remote_file. This allows for better
subscribe/notify of the dotnet defined type as remote_file does not have
any intermediate file fragment resources which may be used or changed
even if the file to download is not changed. The remote_file resource is
also platform agnostic, unlike download_file, more meaning it may be
accessible and familar to a wider range of potential users/contributors.

Update for Puppet 4 and remove deps

Use Puppet 4's type system to deal with validation and remove dependency
on stdlib. Use the $::os fact to get Windows release version and remove
dependency on windowsfacts.

Add logic to prevent incompatible versions

Some versions of .NET are in-place upgrades of others. Installation of
.NET 4.5, for example, will replace the 4.0 package. In order to
disallow Puppet from continuously trying to install .NET 4.0 in the
event dotnet resources for both 4.0 and 4.5 have been added to the
catalog, create a package=absent resource for each conflicting version.
This will cause the conflict to be caught when a catalog is compiled for
the node.

Add ability to recognize built-in .NET versions

Some OSes have some versions of .NET built in and so do not need to have
it installed via package. It seems likely this was auto-detected based
on registry key presence/absence via exec previously. Because we're now
managing the package directly, we should be more explicit about whether
or not the package actually needs to be installed.

Clean up installation type detection

Regex adjustments to make it easier to read which versions support which
installation types.

Only test on 4.x/future parser

Set gemfile to use PUPPET_GEM_VERSION and set default to 4.0

Adjust tests to match updates

This is not a comprehensive test overhaul, but does update the
functional tests to work with the updated code.

Logic correction - For 2008, .NET 3.5 is a package

Previously the dotnet define logic would attempt to install .NET 3.5 as
a feature on Server 2008. This was incorrect, as in Server 2008 .NET 3.5
was not available as a feature and needed the package installation.

Add Dism install type for Windows 7

Windows 7 does not install .NET as a package, nor does it have the
ServerManager module. Therefore provide an alternative means of managing
the feature via DISM.

Fix non-functional onlyif in powershell exec

The Puppet Exec resource uses the return code of command, unless, and
onlyif to determine success/failure or if action is necessary.
Previously, the onlyif in dotnet::install::feature would never exit with
a non-zero exit code, even if the Test-Path command returned a False
object. Return object and exit code are not the same thing.

This commit modifies the onlyif to ensure that if the Test-Path command
returns false a non-zero exit code will occur.

(style) Line up case blocks

Add feature parameter to dotnet::install::feature

This will allow specification of different feature names. Necessary
specifically because the feature name to install .NET 3.5 on Server 2012
is not the same feature as to install 4.5.

The feature name for .NET 3.5 in Server 2012 is not AS-NET-Framework,
which we use as the default feature. This commit also updates the dotnet
type to attempt installation of the correct feature when 3.5 is
specified on Server 2012.
@vinzent
Copy link
Contributor

vinzent commented Dec 16, 2017

closing because of no progress since over a year

@vinzent vinzent closed this Dec 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants