Class: InfluxdbSetup::CreateUser
- Defined in:
- lib/influxdb_setup/create_user.rb
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
Methods inherited from Command
Constructor Details
This class inherits a constructor from InfluxdbSetup::Command
Instance Method Details
#call ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/influxdb_setup/create_user.rb', line 3 def call db = @config.db_name user = @config.username pass = @config.password root = @config.build_client users = root.list_users.map{|user_hash| user_hash["username"]} unless users.include?(user) root.create_database_user(db, user, pass) else log "Influxdb user '#{user}'@'#{db}' already exists" end end |