Sha256: f450e4d0cc4e8afade170173201021cec3b8ef4c4d40c05e93a6a47a70091931
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
Contents
module Flucti module Resources class DbServer < BasicResource has_many :databases has_one :ssh_details def to_s return super unless [:vps, :port].all? { |attribute| attribute_set? attribute } "#{vps}:#{port}" end def root RootUser.new(get(:root)) end class RootUser < Struct.new(:login, :password) def initialize(response) super *response['root'].values_at('login', 'password') end def command(db, queries) command = "env HISTFILE= echo -e \"#{queries}\" | mysql -h 127.0.0.1 -u #{login} -p'#{password}' -B --skip-column-names" command << " #{db}" if db return command end def command_for_display(db, queries) "env HISTFILE= mysql -h 127.0.0.1 -u #{login} -p'#{password}' #{db} -e \"#{queries}\"" end end end class Database < BasicResource self.attribute_for_to_s = :name belongs_to :db_server end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
Flucti-flucti-cli-0.1.16 | lib/flucti/resources/db_server.rb |