Class: Flucti::Resources::DbServer::RootUser
- Inherits:
-
Struct
- Object
- Struct
- Flucti::Resources::DbServer::RootUser
- Defined in:
- lib/flucti/resources/db_server.rb
Instance Attribute Summary collapse
-
#login ⇒ Object
Returns the value of attribute login.
-
#password ⇒ Object
Returns the value of attribute password.
Instance Method Summary collapse
- #command(db, queries) ⇒ Object
- #command_for_display(db, queries) ⇒ Object
-
#initialize(response) ⇒ RootUser
constructor
A new instance of RootUser.
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
#login ⇒ Object
Returns the value of attribute login
16 17 18 |
# File 'lib/flucti/resources/db_server.rb', line 16 def login @login end |
#password ⇒ Object
Returns the value of attribute 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 #{login} -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 #{login} -p'#{password}' #{db} -e \"#{queries}\"" end |