Class: Puppet::Provider::NameService::ObjectAdd

Inherits:
Puppet::Provider::NameService show all
Defined in:
lib/vendor/puppet/provider/nameservice/objectadd.rb

Direct Known Subclasses

PW

Constant Summary

Constants included from Util

Util::AbsolutePathPosix, Util::AbsolutePathWindows

Constants included from Util::Docs

Util::Docs::HEADER_LEVELS

Instance Attribute Summary

Attributes inherited from Puppet::Provider

#model, #resource

Attributes included from Util::Docs

#doc, #nodoc

Instance Method Summary collapse

Methods inherited from Puppet::Provider::NameService

#autogen, autogen_default, autogen_defaults, #autogen_id, #create, #delete, #ensure, #exists?, #get, #getinfo, #groups, #info2hash, #initialize, initvars, instances, listbyname, option, options, resource_type=, section, #set, validate, verify

Methods inherited from Puppet::Provider

#<=>, #clear, command, #command, commands, declared_feature?, default?, defaultfor, #get, #initialize, initvars, instances, make_command_methods, mk_resource_methods, mkmodelmethods, #name, optional_commands, #set, specificity, supports_parameter?, #to_s

Methods included from Util::Logging

#clear_deprecation_warnings, #deprecation_warning, #send_log

Methods included from Util

absolute_path?, activerecord_version, benchmark, binread, chuser, classproxy, #execfail, #execpipe, execute, execute_posix, execute_windows, logmethods, memory, path_to_uri, proxy, replace_file, safe_posix_fork, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, #threadlock, uri_to_path, wait_for_output, which, withumask

Methods included from Util::POSIX

#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid

Methods included from Util::Docs

#desc, #dochook, #doctable, #markdown_definitionlist, #markdown_header, #nodoc?, #pad, scrub

Methods included from Util::Warnings

clear_warnings, notice_once, warnonce

Methods included from Confiner

#confine, #confine_collection, #suitable?

Methods included from Util::Errors

#adderrorcontext, #devfail, #error_context, #exceptwrap, #fail

Constructor Details

This class inherits a constructor from Puppet::Provider::NameService

Instance Method Details

#deletecmdObject



5
6
7
# File 'lib/vendor/puppet/provider/nameservice/objectadd.rb', line 5

def deletecmd
  [command(:delete), @resource[:name]]
end

#flag(name) ⇒ Object

Determine the flag to pass to our command.



10
11
12
13
# File 'lib/vendor/puppet/provider/nameservice/objectadd.rb', line 10

def flag(name)
  name = name.intern if name.is_a? String
  self.class.option(name, :flag) || "-" + name.to_s[0,1]
end

#modifycmd(param, value) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/vendor/puppet/provider/nameservice/objectadd.rb', line 15

def modifycmd(param, value)
  cmd = [command(param.to_s =~ /password_.+_age/ ? :password : :modify)]
  cmd << flag(param) << value
  if @resource.allowdupe? && ((param == :uid) || (param == :gid and self.class.name == :groupadd))
    cmd << "-o"
  end
  cmd << @resource[:name]

  cmd
end

#posixmethod(name) ⇒ Object



26
27
28
29
30
31
# File 'lib/vendor/puppet/provider/nameservice/objectadd.rb', line 26

def posixmethod(name)
  name = name.intern if name.is_a? String
  method = self.class.option(name, :method) || name

  method
end