Class: Flucti::Resources::DbServer::RootUser

Inherits:
Struct
  • Object
show all
Defined in:
lib/flucti/resources/db_server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ RootUser

Returns a new instance of RootUser.



17
18
19
# File 'lib/flucti/resources/db_server.rb', line 17

def initialize(response)
  super *response['root'].values_at('login', 'password')
end

Instance Attribute Details

#loginObject

Returns the value of attribute login

Returns:

  • (Object)

    the current value of login



16
17
18
# File 'lib/flucti/resources/db_server.rb', line 16

def 
  @login
end

#passwordObject

Returns the value of attribute password

Returns:

  • (Object)

    the current value of password



16
17
18
# File 'lib/flucti/resources/db_server.rb', line 16

def password
  @password
end

Instance Method Details

#command(db, queries) ⇒ Object



21
22
23
24
25
# File 'lib/flucti/resources/db_server.rb', line 21

def command(db, queries)
  command = "env HISTFILE= echo -e \"#{queries}\" | mysql -h 127.0.0.1 -u #{} -p'#{password}' -B --skip-column-names"
  command << " #{db}" if db
  return command
end

#command_for_display(db, queries) ⇒ Object



27
28
29
# File 'lib/flucti/resources/db_server.rb', line 27

def command_for_display(db, queries)
  "env HISTFILE= mysql -h 127.0.0.1 -u #{} -p'#{password}' #{db} -e \"#{queries}\""
end