components/puppet/files/solaris/lib/puppet/type/ip_interface.rb
changeset 1921 489d0d0f656f
parent 1409 9db4ba32e740
child 1928 dded85e478c9
equal deleted inserted replaced
1920:3ed8d7c25c17 1921:489d0d0f656f
    18 #
    18 #
    19 # CDDL HEADER END
    19 # CDDL HEADER END
    20 #
    20 #
    21 
    21 
    22 #
    22 #
    23 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    23 # Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
    24 #
    24 #
    25 
    25 
    26 Puppet::Type.newtype(:ip_interface) do
    26 Puppet::Type.newtype(:ip_interface) do
    27     @doc = "Manage the configuration of Oracle Solaris IP interfaces"
    27     @doc = "Manage the configuration of Oracle Solaris IP interfaces"
    28 
    28 
    31     newparam(:name) do
    31     newparam(:name) do
    32         desc "The name of the IP interface"
    32         desc "The name of the IP interface"
    33         isnamevar
    33         isnamevar
    34 
    34 
    35         validate do |name|
    35         validate do |name|
    36             cmd = Array["/usr/sbin/dladm", "show-phys", "-p", "-o", "link"]
    36             cmd = Array["/usr/sbin/dladm", "show-link", "-p", "-o", "link"]
    37             output = Puppet::Util::Execution.execute(cmd).split("\n")
    37             output = Puppet::Util::Execution.execute(cmd).split("\n")
    38             raise Puppet::Error, "Invalid IP interface name: #{name}" \
    38             raise Puppet::Error, "Invalid IP interface name: #{name}" \
    39                 if not output.include?(name)
    39                 if not output.include?(name)
    40         end
    40         end
    41     end
    41     end