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

syslinux package got split-up in Debian/jessie #132

Closed
wants to merge 1 commit into from
Closed

syslinux package got split-up in Debian/jessie #132

wants to merge 1 commit into from

Conversation

mmoll
Copy link
Contributor

@mmoll mmoll commented Jan 2, 2015

I hope somebody is having a less humble way to do this :)

@ekohl
Copy link
Member

ekohl commented Jan 2, 2015

I'm trying very hard to come up with a less ugly solution. One could be to rewrite sync_file to use basename. The name (hosted_file) could probably be chosen better, but by not touching sync_file it stays backwards compatible.

define foreman_proxy::tftp::hosted_file(
  $target_root,
  $target_filename = undef,
  $source_file = $title,
) {
  $filename = pick($target_filename, basename($source_file))
  file {"${target_root}/${filename}":
    ensure => 'present',
    source => $source_file,
  }
}

Then call it with:

# Would be in params.pp per OS
$foreman_proxy::hosted_files = ['/usr/lib/syslinux/memdisk', '/usr/lib/PXELINUX/pxelinux.0', '/usr/lib/syslinux/modules/bios/chain.c32', '/usr/lib/syslinux/modules/bios/menu.c32']

foreman_proxy::tftp::hosted_file { $foreman_proxy::hosted_files:
  target_root => $foreman_proxy::tftp_root,
}

I don't know if it's better or not, but it keeps the number of variables down.

@mmoll
Copy link
Contributor Author

mmoll commented Jan 7, 2015

Feels a little less 💩

$tftp_syslinux_root = '/usr/lib/syslinux'
case $::osfamily {
'Debian': {
if ($::operatingsystem == 'Debian') and ($::operatingsystemrelease =~ /^8/) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe for future readyness do a versioncmp to see if it's 8 or greater?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't know yet, how this will be in Debian/stretch.

@domcleal
Copy link
Contributor

domcleal commented Jan 7, 2015

I'm not sure we should consider sync_file a public API, although I'll admit we haven't marked it as private. (We should definitely mark copy_file as private in the comments if we're adding it, so we don't get this again.)

@domcleal
Copy link
Contributor

domcleal commented Jan 7, 2015

And I think we need some tests, as the syslinux_filenames parameter issue would have been picked up :)

$source_file = $title,
) {
private()
$filename = inline_template('<%= File.basename(source_file) %>')
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a TODO that the newest stdlib will have this?

@ekohl
Copy link
Member

ekohl commented Feb 2, 2015

@domcleal what do you think about dropping the parameters? It'd mean a major version bump. We could leave them in and have a warning so we break less.


case $::osfamily {
'Debian': {
if ($::operatingsystem == 'Debian') and ($::operatingsystemrelease =~ /^8/) {
Copy link
Contributor

Choose a reason for hiding this comment

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

versioncmp so it can also match newer versions?

@domcleal
Copy link
Contributor

domcleal commented Feb 5, 2015

@ekohl I'm not sure.. I don't mind if we need to bump it I suppose, though it doesn't seem a particularly important or large change. The alternative is to leave them both in but with undef defaults, leave sync_file in and then add a deprecation warning if they're ever set, or sync_file is called - which I prefer.

@ekohl
Copy link
Member

ekohl commented Feb 5, 2015

I agree that leaving them in and adding a warning is better. That does mean every installer user who uses an old answer file will see deprecation warnings if they enable verbose output, but that's fine.

@@ -13,8 +13,7 @@
recurse => true;
}

foreman_proxy::tftp::sync_file{$foreman_proxy::tftp_syslinux_files:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to keep this if tftp_syslinux_files is set?

Copy link
Contributor

Choose a reason for hiding this comment

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

and print a deprecation warning here too

Copy link
Member

Choose a reason for hiding this comment

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

Certainly we should print a warning, but I'm not sure about syncing them as well. In a pure puppet world I would agree but with the installer and old answer files I'm afraid about duplicate syncs. If a user upgraded their debian as well it would lead to errors. OTOH that's a bit of an edge case.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe put the new block in an "else" clause of if $foreman_proxy::tftp_syslinux_files?

Copy link
Member

Choose a reason for hiding this comment

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

That makes sense.

@domcleal
Copy link
Contributor

domcleal commented Feb 5, 2015

Looks correct to me! 👍

I might give it a quick test first, as we're missing coverage in this area.

@domcleal
Copy link
Contributor

domcleal commented Feb 5, 2015

Should we add Debian 8 to the supported OS list, or wait? Are there other issues in this module?

require => Class['tftp::install'];
}

warning('foreman_proxy::tftp_syslinux_files is deprecated and will be removed')
Copy link
Member

Choose a reason for hiding this comment

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

.. deprecated in favor of tftp_syslinux_filenames ...

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, and please add a note to the init.pp parameter documentation to say the old parameters are deprecated.

@mmoll
Copy link
Contributor Author

mmoll commented Feb 5, 2015

Updated. I'll have to test this again on a fresh box, but it worked fine on jessie.

# deprecated, see $tftp_syslinux_filenames)
# type:array
#
# $tftp_syslinux_filenames:: Syslinux files to install on TFTP (pull paths)
Copy link
Contributor

Choose a reason for hiding this comment

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

Er, this parameter doesn't actually exist, it's just in params :)

@mmoll
Copy link
Contributor Author

mmoll commented Feb 15, 2015

Now with minimal corrections and one minimal test. I expected when the facts are set accordingly, e.g. should contain_foreman_proxy__tftp__copy_file('/usr/lib/PXELINUX/pxelinux.0') would work, but it doesn't. Any hints?

@domcleal
Copy link
Contributor

domcleal@eae9638 works, feel free to squash it in.

@mmoll
Copy link
Contributor Author

mmoll commented Feb 16, 2015

Thanks @domcleal, I extended it a bit, seems I'm having some problems with the tests, as others also fail for no reason... Anyway, I hope we're good to go with this one now. 🙏

@@ -133,9 +133,11 @@
#
# $tftp_listen_on:: TFTP proxy to listen on https, http, or both
#
# $tftp_syslinux_root:: Directory that hold syslinux files
# $tftp_syslinux_filenames:: Syslinux files to install on TFTP (pull paths)
Copy link
Contributor

Choose a reason for hiding this comment

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

"full" paths

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@domcleal
Copy link
Contributor

👍

@@ -133,9 +133,11 @@
#
# $tftp_listen_on:: TFTP proxy to listen on https, http, or both
#
# $tftp_syslinux_root:: Directory that hold syslinux files
Copy link
Member

Choose a reason for hiding this comment

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

This parameter should stay in but marked as deprecated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, in again.

@ekohl
Copy link
Member

ekohl commented Feb 17, 2015

👍

@mmoll mmoll closed this in 468eb0c Feb 17, 2015
@domcleal
Copy link
Contributor

Merged, thanks @mmoll!

@mmoll mmoll deleted the jessie branch February 20, 2015 20:59
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

3 participants