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 17 18 |
# 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"]} if user.nil? log "Influxdb user not specified, using the default one..." elsif users.include?(user) log "Influxdb user '#{user}'@'#{db}' already exists" else root.create_database_user(db, user, pass) end end |