Update monasca-agent cookbook and barclamp#2
Update monasca-agent cookbook and barclamp#2artur-ba merged 64 commits intoFujitsuEnablingSoftwareTechnologyGmbH:monascafrom matrixik:monasca
Conversation
| end | ||
|
|
||
| node.save | ||
|
|
There was a problem hiding this comment.
Style/TrailingBlankLines: 1 trailing blank lines detected. (https://github.com/bbatsov/ruby-style-guide#newline-eof)
| ha_enabled = node[:monasca][:ha][:enabled] | ||
|
|
||
| my_admin_host = CrowbarHelper.get_host_for_admin_url(node, ha_enabled) | ||
| my_public_host = CrowbarHelper.get_host_for_public_url( |
There was a problem hiding this comment.
Lint/UselessAssignment: Useless assignment to variable - my_public_host. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
| monasca_protocol = ssl_enabled ? "https" : "http" | ||
| ha_enabled = node[:monasca][:ha][:enabled] | ||
|
|
||
| my_admin_host = CrowbarHelper.get_host_for_admin_url(node, ha_enabled) |
There was a problem hiding this comment.
Lint/UselessAssignment: Useless assignment to variable - my_admin_host. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
|
|
||
| monasca_port = node[:monasca][:api][:bind_port] | ||
| ssl_enabled = node[:monasca][:api][:ssl] | ||
| monasca_protocol = ssl_enabled ? "https" : "http" |
There was a problem hiding this comment.
Lint/UselessAssignment: Useless assignment to variable - monasca_protocol. Did you mean monasca_port? (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
|
|
||
| keystone_settings = KeystoneHelper.keystone_settings(node, @cookbook_name) | ||
|
|
||
| monasca_port = node[:monasca][:api][:bind_port] |
There was a problem hiding this comment.
Lint/UselessAssignment: Useless assignment to variable - monasca_port. Did you mean monasca_protocol? (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
| action :add_service | ||
| end | ||
|
|
||
| keystone_register "register monasca-agent endpoint" do |
There was a problem hiding this comment.
I think that needs to go api.rb, you install monasca-api you register an endpoint for it.
|
|
||
| # agent_nodes.each do |agent_node| | ||
| # base["attributes"][@bc_name]["keystone_agents_credentials"]["node_name"] = "#{agent_node.name}" | ||
| # base["attributes"][@bc_name]["keystone_agents_credentials"]["username"] = "mon-agent-#{agent_node.name}" |
There was a problem hiding this comment.
Metrics/LineLength: Line is too long. [112/100] (https://github.com/SUSE/style-guides/blob/master/Ruby.md#metricslinelength)
|
|
||
| # agent_nodes.each do |agent_node| | ||
| # base["attributes"][@bc_name]["keystone_agents_credentials"]["node_name"] = "#{agent_node.name}" | ||
| # base["attributes"][@bc_name]["keystone_agents_credentials"]["username"] = "mon-agent-#{agent_node.name}" |
There was a problem hiding this comment.
Metrics/LineLength: Line is too long. [112/100] (https://github.com/SUSE/style-guides/blob/master/Ruby.md#metricslinelength)
| base["attributes"][@bc_name][:db][:password] = random_password | ||
|
|
||
| # agent_nodes.each do |agent_node| | ||
| # base["attributes"][@bc_name]["keystone_agents_credentials"]["node_name"] = "#{agent_node.name}" |
There was a problem hiding this comment.
Metrics/LineLength: Line is too long. [103/100] (https://github.com/SUSE/style-guides/blob/master/Ruby.md#metricslinelength)
| base["attributes"][@bc_name][:db][:password] = random_password | ||
|
|
||
| # agent_nodes.each do |agent_node| | ||
| # base["attributes"][@bc_name]["keystone_agents_credentials"]["node_name"] = "#{agent_node.name}" |
There was a problem hiding this comment.
Metrics/LineLength: Line is too long. [103/100] (https://github.com/SUSE/style-guides/blob/master/Ruby.md#metricslinelength)
| mode 0o640 | ||
| variables agent_settings | ||
| variables ( | ||
| agent_settings: agent_settings, |
| mode 0o640 | ||
| variables agent_settings | ||
| variables ( | ||
| agent_settings: agent_settings, |
|
|
||
| agent_settings[:monasca_url] = "#{monasca_protocol}://#{monasca_public_host}/v2.0" | ||
|
|
||
| agent_settings[:dimensions] = { "service": "monitoring" } |
| monasca_protocol = ssl_enabled ? "https" : "http" | ||
| ha_enabled = monasca_server[:monasca][:ha][:enabled] | ||
|
|
||
| monasca_public_host = CrowbarHelper.get_host_for_public_url( |
There was a problem hiding this comment.
Lint/UselessAssignment: Useless assignment to variable - monasca_public_host. Did you mean monasca_protocol? (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
d78d8db to
9208ba5
Compare
| answer | ||
| end | ||
|
|
||
| def create_proposal |
There was a problem hiding this comment.
Metrics/AbcSize: Assignment Branch Condition size for create_proposal is too high. [31.08/30] (https://github.com/SUSE/style-guides/blob/master/Ruby.md#metricsabcsize, http://c2.com/cgi/wiki?AbcMetric)
| "suse" => "< 12.1", | ||
| "windows" => "/.*/" | ||
| } | ||
| }, |
There was a problem hiding this comment.
Style/TrailingCommaInLiteral: Avoid comma after the last item of a hash. (https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas)
| @@ -0,0 +1,5 @@ | |||
| name "monasca-server" | |||
There was a problem hiding this comment.
Style/FileName: The name of this source file (monasca-server.rb) should use snake_case. (https://github.com/bbatsov/ruby-style-guide#snake-case-files)
chef/roles/monasca-agent.rb
Outdated
| @@ -0,0 +1,5 @@ | |||
| name "monasca-agent" | |||
There was a problem hiding this comment.
Style/FileName: The name of this source file (monasca-agent.rb) should use snake_case. (https://github.com/bbatsov/ruby-style-guide#snake-case-files)
|
|
||
| if CrowbarRoleRecipe.node_state_valid_for_role?(node, "monasca", "monasca-server") | ||
| include_recipe "monasca::server" | ||
| # include_recipe "monasca::api" |
There was a problem hiding this comment.
Style/CommentIndentation: Incorrect indentation detected (column 0 instead of 2).
| mode 0o0640 | ||
| variables( | ||
| database_connection: database_connection, | ||
| keystone_settings: KeystoneHelper.keystone_settings(node, @cookbook_name), |
There was a problem hiding this comment.
Style/TrailingCommaInArguments: Avoid comma after the last parameter of a method call. (https://github.com/bbatsov/ruby-style-guide#no-trailing-params-comma)
| db_settings = fetch_database_settings | ||
| db_conn_scheme = db_settings[:url_scheme] | ||
|
|
||
| if db_settings[:backend_name] == "mysql" |
There was a problem hiding this comment.
Style/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||. (https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier)
| agent_settings = node[:monasca][:agent][:config] | ||
| keystone_settings = KeystoneHelper.keystone_settings(node, @cookbook_name) | ||
|
|
||
| monasca_port = node[:monasca][:api][:bind_port] |
There was a problem hiding this comment.
Lint/UselessAssignment: Useless assignment to variable - monasca_port. Did you mean monasca_protocol? (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
|
I have problems with the GUI part: Edit: |
kornicameister
left a comment
There was a problem hiding this comment.
Part that I don't like is the one where you try to copy custom templates. That has little chance of working reliably.
And rename all variables to reflect this change.
| @@ -0,0 +1,5 @@ | |||
| name "monasca-metric-agent" | |||
There was a problem hiding this comment.
Style/FileName: The name of this source file (monasca-metric-agent.rb) should use snake_case. (https://github.com/bbatsov/ruby-style-guide#snake-case-files)
| @@ -1,4 +1,4 @@ | |||
| # # Copyright 2017 FUJITSU LIMITED | |||
| # Copyright 2017 FUJITSU LIMITED | |||
There was a problem hiding this comment.
Style/FileName: The name of this source file (monasca-log-agent.rb) should use snake_case. (https://github.com/bbatsov/ruby-style-guide#snake-case-files)
| monasca_url = "#{monasca_protocol}://#{monasca_public_host}/v3" | ||
| elasticsearch_url = "http://localhost:9200/" | ||
| kibana_url = "http://#{monasca_public_host}:5601" | ||
| log_api_url = "http://#{monasca_public_host}:#{node[:monasca][:log_api][:bind_port]}" |
There was a problem hiding this comment.
Lint/UselessAssignment: Useless assignment to variable - log_api_url. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
| service = "monitoring" | ||
| monasca_url = "#{monasca_protocol}://#{monasca_public_host}/v3" | ||
| elasticsearch_url = "http://localhost:9200/" | ||
| kibana_url = "http://#{monasca_public_host}:5601" |
There was a problem hiding this comment.
Lint/UselessAssignment: Useless assignment to variable - kibana_url. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
| agent_dimensions = { service: "monitoring" } | ||
| service = "monitoring" | ||
| monasca_url = "#{monasca_protocol}://#{monasca_public_host}/v3" | ||
| elasticsearch_url = "http://localhost:9200/" |
There was a problem hiding this comment.
Lint/UselessAssignment: Useless assignment to variable - elasticsearch_url. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
| packages: [], | ||
| services: [monasca_log_agent_service_name] | ||
| services: [ | ||
| monasca_agent_service_name, |
There was a problem hiding this comment.
the variable name is monasca_metric_agent_service_name
|
|
||
| agent_dimensions = { service: "monitoring" } | ||
| service = "monitoring" | ||
| monasca_url = "#{monasca_protocol}://#{monasca_public_host}/v3" |
| service = "monitoring" | ||
| monasca_url = "#{monasca_protocol}://#{monasca_public_host}/v3" | ||
|
|
||
| template "/etc/sudoers.d/monasca-agent_sudoers" do |
There was a problem hiding this comment.
IHMO the _sudoers suffix is redundant, I'd remove it
| @@ -0,0 +1,32 @@ | |||
| # | |||
| # Copyright 2011-2013, Dell | |||
There was a problem hiding this comment.
Maybe it should be Copyright 2015 FUJITSU LIMITED?
| service = "monitoring" | ||
| monasca_url = "#{monasca_protocol}://#{monasca_public_host}/v3" | ||
|
|
||
| template "/etc/sudoers.d/monasca-agent" do |
There was a problem hiding this comment.
This belongs into packaging not in the barclamp
There was a problem hiding this comment.
Well, I did not found any sudo in rpm-packaging however I found it in crowbar-openstack...:
https://github.com/crowbar/crowbar-openstack/blob/master/chef/cookbooks/nova/recipes/monitor.rb#L50-L55
But we will move it if you want.
There was a problem hiding this comment.
I have added sudoers configuration here.
There was a problem hiding this comment.
Code for sudoers removed from barclamp
| # metric-agent default service settings | ||
| default[:monasca][:metric_agent][:service_name] = monasca_metric_agent_service_name | ||
| default[:monasca][:metric_agent][:user] = "monasca-agent" | ||
| default[:monasca][:metric_agent][:group] = "monasca-agent" |
There was a problem hiding this comment.
Group should be monasca. As we discussed with other guys from community about rpm packaging.
Will be added from rpm.
|
Added SLES to supported dists to monasca-agent: Otherwise barclamp is erroring with: |
* Add monasca-reconfigure and sudoers file * Fix monasca-setup bin path * Fix template variables * Keystone settings for agent * Keystone settings for agent * Keystone settings for agent * Add log * More readable config templates * Remove log * Remove per-node credentials todos * Fix json indentations * Rename agent dimensions variable name * Run monasca-reconfigure every time with chef client * Add firts GUI elements * Add GUI elements * Update for new code arrangement for keystone * Fix yaml for translations * Fix monasca helper module name * Use root user for agent temporally * Update monasca agent GUI parts * WIP: Add custom checks for monasca-agent * Extract variables for templates * Fix testing filepath * Fix template for monasca agent checks * Fix template paths again * Address Hound warning * Add more monasca agent checkers * Fix some variables * Add log api port to data_bag * Build Kibana and log-api urls * Add more info to GUI * Add user_managed: false * Fix yaml indentation * Add some logs * Fix monasca-reconfigure * Fix ruby boolean name * Uncomment agent.yaml template code * Fix providing service variable to template * Fix insecure args for monasca-setup * Fix monasca-reconfigure * Configure more variables with monasca-reconfigure * Add more config to UI * Disable generating agent.yaml It's regenerated every time chef client is run, it's running monasca-reconfigure. * Change default overwrite config to false * Add monasca-agent to sudoers * Run monasca-setup as monasca-agent user * Remove logs from monasca-reconfigure * Rename monasca-agent to monasca-metric-agent And rename all variables to reflect this change. * Fix hound warnings * Address comments * Fix copyright * Use same order in data_bag schema like in json * Restore user mapping in log_agent schema * Change monasca-master unique to false * Fix monasca-metric-agents names in json * Use keystone settings from data_bag for metric agent * Replace `owner` with `user` in execute command * Replace group `monasca-agent` with `monasca` * Remove adding monasca-agent to sudoers Will be added from rpm. * Add port to monasca_api_url for monasca-agent * Use helper for getting api url * Fix bad default config name
…chnologyGmbH#2) * Add monasca-reconfigure and sudoers file * Fix monasca-setup bin path * Fix template variables * Keystone settings for agent * Keystone settings for agent * Keystone settings for agent * Add log * More readable config templates * Remove log * Remove per-node credentials todos * Fix json indentations * Rename agent dimensions variable name * Run monasca-reconfigure every time with chef client * Add firts GUI elements * Add GUI elements * Update for new code arrangement for keystone * Fix yaml for translations * Fix monasca helper module name * Use root user for agent temporally * Update monasca agent GUI parts * WIP: Add custom checks for monasca-agent * Extract variables for templates * Fix testing filepath * Fix template for monasca agent checks * Fix template paths again * Address Hound warning * Add more monasca agent checkers * Fix some variables * Add log api port to data_bag * Build Kibana and log-api urls * Add more info to GUI * Add user_managed: false * Fix yaml indentation * Add some logs * Fix monasca-reconfigure * Fix ruby boolean name * Uncomment agent.yaml template code * Fix providing service variable to template * Fix insecure args for monasca-setup * Fix monasca-reconfigure * Configure more variables with monasca-reconfigure * Add more config to UI * Disable generating agent.yaml It's regenerated every time chef client is run, it's running monasca-reconfigure. * Change default overwrite config to false * Add monasca-agent to sudoers * Run monasca-setup as monasca-agent user * Remove logs from monasca-reconfigure * Rename monasca-agent to monasca-metric-agent And rename all variables to reflect this change. * Fix hound warnings * Address comments * Fix copyright * Use same order in data_bag schema like in json * Restore user mapping in log_agent schema * Change monasca-master unique to false * Fix monasca-metric-agents names in json * Use keystone settings from data_bag for metric agent * Replace `owner` with `user` in execute command * Replace group `monasca-agent` with `monasca` * Remove adding monasca-agent to sudoers Will be added from rpm. * Add port to monasca_api_url for monasca-agent * Use helper for getting api url * Fix bad default config name
* Add monasca-reconfigure and sudoers file * Fix monasca-setup bin path * Fix template variables * Keystone settings for agent * Keystone settings for agent * Keystone settings for agent * Add log * More readable config templates * Remove log * Remove per-node credentials todos * Fix json indentations * Rename agent dimensions variable name * Run monasca-reconfigure every time with chef client * Add firts GUI elements * Add GUI elements * Update for new code arrangement for keystone * Fix yaml for translations * Fix monasca helper module name * Use root user for agent temporally * Update monasca agent GUI parts * WIP: Add custom checks for monasca-agent * Extract variables for templates * Fix testing filepath * Fix template for monasca agent checks * Fix template paths again * Address Hound warning * Add more monasca agent checkers * Fix some variables * Add log api port to data_bag * Build Kibana and log-api urls * Add more info to GUI * Add user_managed: false * Fix yaml indentation * Add some logs * Fix monasca-reconfigure * Fix ruby boolean name * Uncomment agent.yaml template code * Fix providing service variable to template * Fix insecure args for monasca-setup * Fix monasca-reconfigure * Configure more variables with monasca-reconfigure * Add more config to UI * Disable generating agent.yaml It's regenerated every time chef client is run, it's running monasca-reconfigure. * Change default overwrite config to false * Add monasca-agent to sudoers * Run monasca-setup as monasca-agent user * Remove logs from monasca-reconfigure * Rename monasca-agent to monasca-metric-agent And rename all variables to reflect this change. * Fix hound warnings * Address comments * Fix copyright * Use same order in data_bag schema like in json * Restore user mapping in log_agent schema * Change monasca-master unique to false * Fix monasca-metric-agents names in json * Use keystone settings from data_bag for metric agent * Replace `owner` with `user` in execute command * Replace group `monasca-agent` with `monasca` * Remove adding monasca-agent to sudoers Will be added from rpm. * Add port to monasca_api_url for monasca-agent * Use helper for getting api url * Fix bad default config name
No description provided.