lib/nexussw/lxd/transport/mixins/helpers/users.rb in lxd-common-0.9.8 vs lib/nexussw/lxd/transport/mixins/helpers/users.rb in lxd-common-0.9.9

- old
+ new

@@ -1,16 +1,16 @@ -require 'shellwords' +require "shellwords" module NexusSW module LXD class Transport module Mixins module Helpers module UsersMixin def user(user_nameorid, options = {}) return unless user_nameorid - passwd = read_file options[:passwd_file] || '/etc/passwd' + passwd = read_file options[:passwd_file] || "/etc/passwd" # rework into .split(':') if this gets more complicated @uid = user_nameorid.is_a?(String) ? passwd[/^#{user_nameorid}:[^:]*:([^:]*):/, 1] : user_nameorid @username = user_nameorid.is_a?(String) ? user_nameorid : passwd[/^([^:]*):[^:]*:#{user_nameorid}:/, 1] raise "User not found (#{user_nameorid}) while attempting to set transport identity" unless @uid && @username @@ -31,10 +31,10 @@ def runas_command(command, options = {}) uname = options[:runas] || username return command unless uname command = command.shelljoin if command.is_a? Array - ['su', uname, '-c', command] + ["su", uname, "-c", command] end end end end end