Object
# File lib/openshift-origin-node/utils/sdk.rb, line 12 def self.mark_new_sdk_app(gear_home) IO.write(File.join(gear_home, '.env', MARKER), '2', 0) end
# File lib/openshift-origin-node/utils/sdk.rb, line 8 def self.new_sdk_app?(gear_home) File.exists?(File.join(gear_home, '.env', MARKER)) end
# File lib/openshift-origin-node/utils/sdk.rb, line 16 def self.node_default_model(config) v1_marker_exist = File.exist?(File.join(config.get('GEAR_BASE_DIR'), '.settings', 'v1_cartridge_format')) v2_marker_exist = File.exist?(File.join(config.get('GEAR_BASE_DIR'), '.settings', 'v2_cartridge_format')) if v1_marker_exist and v2_marker_exist raise 'Node cannot create both v1 and v2 formatted cartridges. Delete one of the cartridge format marker files' end if v1_marker_exist return :v1 else return :v2 end end
Public: Translate a String destined for the client with CLIENT_ prefixes. Handles newlines and skips lines which are already prefixed.
out - The String to translate. type - Either :message or :error.
Examples
translate_out_for_client("A message", :message) # => "CLIENT_MESSAGE: A message" translate_out_for_client("An error", :error) # => "CLIENT_ERROR: An error"
Returns the translated String.
# File lib/openshift-origin-node/utils/sdk.rb, line 66 def self.translate_out_for_client(out, type = :message) return '' unless out suffix = (type == :error ? "ERROR" : "MESSAGE") out.split("\n").map { |l| l.start_with?('CLIENT_') ? l : "CLIENT_#{suffix}: #{l}" }.join("\n") end
Public: Translates a ShellExecutionException into a new instance whose stdout, stderr, and return code are suitable for returning to the client. Output is translated with translate_out_for_client, and return codes < 100 are mapped to 157.
e - The ShellExecutionException to translate. rc_override - If not Nil, the given return code will be used in place of the actual
return code present on e.
Returns the translated ShellExecutionException instance.
# File lib/openshift-origin-node/utils/sdk.rb, line 39 def self.translate_shell_ex_for_client(e, rc_override = nil) return e unless (e && e.is_a?(Utils::ShellExecutionException)) stdout = self.translate_out_for_client(e.stdout, :message) stderr = self.translate_out_for_client(e.stderr, :error) rc = rc_override || e.rc ex = Utils::ShellExecutionException.new(e.message, rc, stdout, stderr) ex.set_backtrace(e.backtrace) ex end
Generated with the Darkfish Rdoc Generator 2.