Sha256: 22ce22957b38c9b9e1e12858da5bee4e0b1367a0d5229cde1de9f99dba21f77a

Contents?: true

Size: 1.27 KB

Versions: 21

Compression:

Stored size: 1.27 KB

Contents

module Rudy; module Routines; module Handlers;
  module User
    include Rudy::Routines::Handlers::Base
    extend self 
    
    Rudy::Routines.add_handler :adduser, self
    Rudy::Routines.add_handler :authorize, self
    
    def raise_early_exceptions(type, user, rset, lbox, argv=nil)
      
    end
    
    def execute(type, user, rset, lbox, argv=nil)
      raise NoMachines if rset.boxes.empty?
      send(type, user, rset)
    end
    
    def adduser(user, robj)
      
      # On Solaris, the user's home directory needs to be specified
      # explicitly so we do it for linux too for fun. 
      homedir = robj.guess_user_home(user.to_s)
      
      # When more than one machine is running, this will be an Array
      homedir = homedir.first if homedir.kind_of?(Array)
      
      args = [:m, :d, homedir, :s, '/bin/bash', user.to_s]
      
      # NOTE: We'll may to use platform specific code here. 
      # Linux has adduser and useradd commands:
      # adduser can prompt for info which we don't want. 
      # useradd does not prompt (on Debian/Ubuntu at least). 
      # We need to specify bash b/c the default is /bin/sh
      robj.useradd(args)
    end
    
    def authorize(user, robj)
      robj.authorize_keys_remote(user.to_s)
    end
    
    
  end
  
end; end; end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
solutious-rudy-0.9.1 lib/rudy/routines/handlers/user.rb
solutious-rudy-0.9.2 lib/rudy/routines/handlers/user.rb
solutious-rudy-0.9.3 lib/rudy/routines/handlers/user.rb
solutious-rudy-0.9.4 lib/rudy/routines/handlers/user.rb
rudy-0.9.8.006 lib/rudy/routines/handlers/user.rb
rudy-0.9.8.005 lib/rudy/routines/handlers/user.rb
rudy-0.9.8.004 lib/rudy/routines/handlers/user.rb
rudy-0.9.8.003 lib/rudy/routines/handlers/user.rb
rudy-0.9.8.002 lib/rudy/routines/handlers/user.rb
rudy-0.9.8.001 lib/rudy/routines/handlers/user.rb
rudy-0.9.7.001 lib/rudy/routines/handlers/user.rb
rudy-0.9.6.001 lib/rudy/routines/handlers/user.rb
rudy-0.9.5.004 lib/rudy/routines/handlers/user.rb
rudy-0.9.5.003 lib/rudy/routines/handlers/user.rb
rudy-0.9.5.002 lib/rudy/routines/handlers/user.rb
rudy-0.9.5 lib/rudy/routines/handlers/user.rb
rudy-0.9.4 lib/rudy/routines/handlers/user.rb
rudy-0.9.3 lib/rudy/routines/handlers/user.rb
rudy-0.9.2 lib/rudy/routines/handlers/user.rb
rudy-0.9.0 lib/rudy/routines/handlers/user.rb