Parent

Included Modules

OpenShift::UnixUserObserver

Public Instance Methods

after_add_ssh_key(user,key) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 73
def after_add_ssh_key(user,key)
  restore_ssh_key_file_config(user)
end
after_initialize_homedir(user) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 33
def after_initialize_homedir(user)
  cmd = "/bin/sh #{File.join('/usr/libexec/openshift/lib', "setup_pam_fs_limits.sh")} #{user.name} #{user.quota_blocks ? user.quota_blocks : ''} #{user.quota_files ? user.quota_files : ''}"
  out,err,rc = shellCmd(cmd)
  raise OpenShift::UserCreationException.new("Unable to setup pam/fs limits for #{user.name}: stdout -- #{out} stderr -- #{err}") unless rc == 0
end
after_initialize_openshift_port_proxy(user) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 57
def after_initialize_openshift_port_proxy(user)
end
after_remove_ssh_key(user,key) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 80
def after_remove_ssh_key(user,key)
end
after_replace_ssh_keys(user) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 86
def after_replace_ssh_keys(user)
  restore_ssh_key_file_config(user)
end
after_unix_user_create(user) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 22
def after_unix_user_create(user)
  out,err,rc = shellCmd("service cgconfig status > /dev/null 2>&1")
  if rc == 0
    out,err,rc = shellCmd("/usr/sbin/oo-admin-ctl-cgroups startuser #{user.name} > /dev/null")
    raise OpenShift::UserCreationException.new("Unable to setup cgroups for #{user.name}: stdout -- #{out} stderr --#{err}}") unless rc == 0
  end
end
after_unix_user_destroy(user) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 60
def after_unix_user_destroy(user)
  out,err,rc = shellCmd("service cgconfig status > /dev/null")
  shellCmd("/usr/sbin/oo-admin-ctl-cgroups thawuser #{user.name} > /dev/null") if rc == 0
  shellCmd("/usr/sbin/oo-admin-ctl-cgroups stopuser #{user.name} > /dev/null") if rc == 0

  cmd = "/bin/sh #{File.join("/usr/libexec/openshift/lib", "teardown_pam_fs_limits.sh")} #{user.name}"
  out,err,rc = shellCmd(cmd)
  raise OpenShift::UserCreationException.new("Unable to teardown pam/fs/nproc limits for #{user.name}") unless rc == 0
end
before_add_ssh_key(user,key) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 70
def before_add_ssh_key(user,key)
end
before_initialize_homedir(user) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 30
def before_initialize_homedir(user)
end
before_initialize_openshift_port_proxy(user) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 54
def before_initialize_openshift_port_proxy(user)
end
before_remove_ssh_key(user,key) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 77
def before_remove_ssh_key(user,key)
end
before_replace_ssh_keys(user) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 83
def before_replace_ssh_keys(user)
end
before_unix_user_create(user) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 19
def before_unix_user_create(user)
end
before_unix_user_destroy(user) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 40
def before_unix_user_destroy(user)
  cmd = "/bin/sh #{File.join('/usr/libexec/openshift/lib', "setup_pam_fs_limits.sh")} #{user.name} 0 0 0"
  out,err,rc = shellCmd(cmd)
  raise OpenShift::UserCreationException.new("Unable to setup pam/fs/nproc limits for #{user.name}") unless rc == 0

  out,err,rc = shellCmd("service cgconfig status > /dev/null")
  if rc == 0
    shellCmd("/usr/sbin/oo-admin-ctl-cgroups freezeuser #{user.name} > /dev/null") if rc == 0
  end

  last_access_dir = OpenShift::Config.instance.get("LAST_ACCESS_DIR")
  shellCmd("rm -f #{last_access_dir}/#{user.name} > /dev/null")
end
restore_ssh_key_file_config(user) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 90
def restore_ssh_key_file_config(user)
  ssh_dir = File.join(user.homedir, ".ssh")
  cmd = "restorecon -R #{ssh_dir}"
  shellCmd(cmd)
end
update(*args) click to toggle source
# File lib/openshift-origin-node/plugins/unix_user_observer.rb, line 13
def update(*args)
  method = args.first
  args = args.drop(1)
  send(method, *args)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.