Faidon Liambotis has submitted this change and it was merged.

Change subject: Remove requires_ubuntu() / ubuntu_version()
......................................................................


Remove requires_ubuntu() / ubuntu_version()

Change-Id: If6d5d6584d7c5d548a343a0c228d45c5e1a30abf
---
M modules/wmflib/README.md
D modules/wmflib/lib/puppet/parser/functions/requires_ubuntu.rb
D modules/wmflib/lib/puppet/parser/functions/ubuntu_version.rb
3 files changed, 0 insertions(+), 157 deletions(-)

Approvals:
  Faidon Liambotis: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/wmflib/README.md b/modules/wmflib/README.md
index 440fc52..98ed4cf 100644
--- a/modules/wmflib/README.md
+++ b/modules/wmflib/README.md
@@ -301,50 +301,6 @@
     to_seconds('2 days')  # 172800
 
 
-## ubuntu_version
-
-`ubuntu_version( string $version_predicate )`
-
-Performs semantic Ubuntu version comparison.
-
-Takes a single string argument containing a comparison operator
-followed by an optional space, followed by a comparison target,
-provided as Ubuntu version number or release name.
-
-The host's Ubuntu version will be compared to to the comparison target
-using the specified operator, returning a boolean. If no operator is
-present, the equality operator is assumed.
-
-Release names are case-insensitive. The comparison operator and
-comparison target can be provided as two separate arguments, if you
-prefer.
-
-This function is DEPRECATED. Please see os_version() instead.
-
-### Examples
-
-    # True if Precise or newer
-    ubuntu_version('>= precise')
-    ubuntu_version('>= 12.04.4')
-
-    # True if older than Utopic
-    ubuntu_version('< utopic')
-
-    # True if newer than Precise
-    ubuntu_version('> precise')
-
-    # True if Trusty or older
-    ubuntu_version('<= trusty')
-
-    # True if exactly Trusty
-    ubuntu_version('trusty')
-    ubuntu_version('== trusty')
-
-    # True if anything but Trusty
-    ubuntu_version('!trusty')
-    ubuntu_version('!= trusty')
-
-
 ## validate_ensure
 
 `validate_ensure( string $ensure )`
diff --git a/modules/wmflib/lib/puppet/parser/functions/requires_ubuntu.rb 
b/modules/wmflib/lib/puppet/parser/functions/requires_ubuntu.rb
deleted file mode 100644
index 3e68cdc..0000000
--- a/modules/wmflib/lib/puppet/parser/functions/requires_ubuntu.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# == Function: requires_ubuntu( string $version_predicate )
-#
-# Validate that the host Ubuntu version satisfies a version
-# check. Abort catalog compilation if not.
-#
-# See the documentation for ubuntu_version() for supported
-# predicate syntax.
-#
-# === Examples
-#
-#  # Fail unless version is Trusty
-#  requires_ubuntu('trusty')
-#
-#  # Fail unless Trusty or newer
-#  requires_ubuntu('> trusty')
-#
-module Puppet::Parser::Functions
-  newfunction(:requires_ubuntu, :arity => 1) do |args|
-    Puppet::Parser::Functions.function(:ubuntu_version)
-    fail(ArgumentError, 'requires_ubuntu(): string argument required') unless 
args.first.is_a?(String)
-    fail(Puppet::ParseError, "Ubuntu #{args.first} required.") unless 
function_ubuntu_version(args)
-  end
-end
diff --git a/modules/wmflib/lib/puppet/parser/functions/ubuntu_version.rb 
b/modules/wmflib/lib/puppet/parser/functions/ubuntu_version.rb
deleted file mode 100644
index 6c998b3..0000000
--- a/modules/wmflib/lib/puppet/parser/functions/ubuntu_version.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-# == Function: ubuntu_version( string $version_predicate )
-#
-# Performs semantic Ubuntu version comparison.
-#
-# Takes a single string argument containing a comparison operator
-# followed by an optional space, followed by a comparison target,
-# provided as Ubuntu version number or release name.
-#
-# The host's Ubuntu version will be compared to to the comparison target
-# using the specified operator, returning a boolean. If no operator is
-# present, the equality operator is assumed.
-#
-# Release names are case-insensitive. The comparison operator and
-# comparison target can be provided as two separate arguments, if you
-# prefer.
-#
-# === Examples
-#
-#  # True if Precise or newer
-#  ubuntu_version('>= precise')
-#  ubuntu_version('>= 12.04.4')
-#
-#  # True if older than Utopic
-#  ubuntu_version('< utopic')
-#
-#  # True if newer than Precise
-#  ubuntu_version('> precise')
-#
-#  # True if Trusty or older
-#  ubuntu_version('<= trusty')
-#
-#  # True if exactly Trusty
-#  ubuntu_version('trusty')
-#  ubuntu_version('== trusty')
-#
-#  # True if anything but Trusty
-#  ubuntu_version('!trusty')
-#  ubuntu_version('!= trusty')
-#
-require 'puppet/util/package'
-
-module Puppet::Parser::Functions
-  ubuntu_releases = {
-    'hardy'    => '8.04',
-    'intrepid' => '8.10',
-    'jaunty'   => '9.04',
-    'karmic'   => '9.10',
-    'lucid'    => '10.04.4',
-    'maverick' => '10.10',
-    'natty'    => '11.04',
-    'oneiric'  => '11.10',
-    'precise'  => '12.04.4',
-    'quantal'  => '12.10',
-    'raring'   => '13.04',
-    'saucy'    => '13.10',
-    'trusty'   => '14.04',
-    'utopic'   => '14.10'
-  }
-
-  newfunction(:ubuntu_version, :type => :rvalue, :arity => 1) do |args|
-    return false unless lookupvar('lsbdistid') == 'Ubuntu'
-
-    unless args.length <= 2 && args.map(&:class).uniq == [String]
-      fail(ArgumentError, 'ubuntu_version() requires a string argument')
-    end
-
-    expr = args.join(' ')
-    unless expr =~ /^([<>=]*) *([\w\.]+)$/
-      fail(ArgumentError, "ubuntu_version(): invalid expression '#{expr}'")
-    end
-
-    current = lookupvar('lsbdistrelease')
-    operator = $1
-    other = ubuntu_releases[$2.downcase] || $2
-    unless /^[\d.]+$/ =~ other
-      fail(ArgumentError, "ubuntu_version(): unknown release '#{other}'")
-    end
-
-    cmp = Puppet::Util::Package.versioncmp(current, other)
-    case operator
-    when '', '=', '==' then cmp == 0
-    when '!=', '!' then cmp != 0
-    when '>'  then cmp == 1
-    when '<'  then cmp == -1
-    when '>=' then cmp >= 0
-    when '<=' then cmp <= 0
-    else fail(ArgumentError, "ubuntu_version(): unknown comparison operator 
'#{operator}'")
-    end
-  end
-end

-- 
To view, visit https://gerrit.wikimedia.org/r/178441
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If6d5d6584d7c5d548a343a0c228d45c5e1a30abf
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Faidon Liambotis <fai...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to