Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload automate models dialogs during log collection #17445

Conversation

jrafanie
Copy link
Member

@jrafanie jrafanie commented May 18, 2018

https://bugzilla.redhat.com/show_bug.cgi?id=1535179

Depends on prior PRs:

Settings.log.collection.include_automate_models_and_dialogs if enabled, we'll include the automate dialogs and models with log collection.

If done on a Zone, the automate models and dialogs will be uploaded by one of the active appliances and will be named based on the appliance that uploaded it.

[root@localhost vmdb]# ls -l /home/test/ftp/files/default_1/EVM_1/
total 6740
-rw-r--r--. 1 test test 3911379 May 18 16:56 Archive_region_0_default_1_EVM_1_20171114_132136_20180516_195707.zip
-rw-r--r--. 1 test test  889927 May 18 16:56 Archive_region_0_default_1_EVM_1_20180516_195713_20180517_032559.zip
-rw-r--r--. 1 test test  284611 May 18 16:56 Archive_region_0_default_1_EVM_1_20180517_032602_20180518_134950.zip
-rw-r--r--. 1 test test 1297150 May 18 16:56 Current_region_0_default_1_EVM_1_20180518_152247_20180518_165608.zip
-rw-r--r--. 1 test test    2719 May 18 16:56 Dialogs_region_0_default_1_EVM_1.zip
-rw-r--r--. 1 test test  506811 May 18 16:56 Models_region_0_default_1_EVM_1.zip

@jrafanie
Copy link
Member Author

cc @ZitaNemeckova

@jrafanie jrafanie requested a review from bdunne May 18, 2018 21:01
@jrafanie jrafanie force-pushed the upload_automate_models_dialogs_during_log_collection branch 3 times, most recently from cec90ae to 3749923 Compare May 21, 2018 16:10
@miq-bot
Copy link
Member

miq-bot commented May 21, 2018

This pull request is not mergeable. Please rebase and repush.

@jrafanie jrafanie removed the wip label May 21, 2018
@jrafanie jrafanie changed the title [WIP] Upload automate models dialogs during log collection Upload automate models dialogs during log collection May 21, 2018
@jrafanie jrafanie force-pushed the upload_automate_models_dialogs_during_log_collection branch 3 times, most recently from d9a3423 to 689e1a0 Compare May 21, 2018 17:31
@jrafanie
Copy link
Member Author

Ok, this is ready for review after rebase. Note, the first commit is the 🍖 of the PR. The last 2 commits are just moving code around.

@jrafanie jrafanie changed the title Upload automate models dialogs during log collection [WIP] Upload automate models dialogs during log collection May 22, 2018
@jrafanie jrafanie added the wip label May 22, 2018
@jrafanie
Copy link
Member Author

Hold off on merging this as of yet. We are trying to be understand where the decision about "collect the automate domain/dialogs belongs"... in the depot itself (new column?), as an option of each attempt to collect logs, or a general settings key.

@jrafanie jrafanie force-pushed the upload_automate_models_dialogs_during_log_collection branch 2 times, most recently from f2a0acf to 69dad37 Compare May 23, 2018 17:32
@jrafanie jrafanie changed the title [WIP] Upload automate models dialogs during log collection Upload automate models dialogs during log collection May 23, 2018
@jrafanie jrafanie removed the wip label May 23, 2018
@jrafanie jrafanie force-pushed the upload_automate_models_dialogs_during_log_collection branch 2 times, most recently from 6ce9c49 to f693308 Compare May 23, 2018 19:08
message.args.first[:only_current] = false
expect_any_instance_of(MiqServer).to receive(:post_historical_logs).once
expect_any_instance_of(MiqServer).to receive(:post_current_logs).once
expect_any_instance_of(MiqServer).to receive(:post_automate_dialogs).once
expect_any_instance_of(MiqServer).to receive(:post_automate_models).once
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will rid this file of expect_any_instance_of after this PR is merged. It hurts me deeply to use this thing. 😭

@jrafanie
Copy link
Member Author

@ZitaNemeckova @bdunne @carbonin please review

Copy link
Member

@carbonin carbonin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good; just a few nits.

false
when nil
Settings.log.collection.include_automate_models_and_dialogs
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return value unless value.nil?
Settings.log.collection.include_automate_models_and_dialogs

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, I was debating using that guard clause because it wasn't really a guard clause. I'm indifferent to which way.

flog goes from 6.5 to 5.1 so I'm good with changing it.

end
msg = "#{log_type} log files from #{who_am_i} are posted"
_log.info("#{log_prefix} #{msg}")
task.update_status("Active", "Ok", msg)
end

def post_automate_models(taskid, log_depot)
domain_zip = Rails.root.join("log", "domain.zip")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we put this in Rails.root.join("tmp") or are you worried about size?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was worried about the size of the file.

@jrafanie jrafanie force-pushed the upload_automate_models_dialogs_during_log_collection branch from f693308 to 5dab507 Compare May 24, 2018 18:35
@miq-bot
Copy link
Member

miq-bot commented May 24, 2018

Some comments on commits jrafanie/manageiq@6fbad9f~...5dab507

spec/models/log_file_spec.rb

  • ⚠️ - 105 - Detected expect_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.
  • ⚠️ - 106 - Detected expect_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.
  • ⚠️ - 113 - Detected expect_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.
  • ⚠️ - 114 - Detected expect_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.
  • ⚠️ - 122 - Detected expect_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.
  • ⚠️ - 123 - Detected expect_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.

@miq-bot
Copy link
Member

miq-bot commented May 24, 2018

Checked commits jrafanie/manageiq@6fbad9f~...5dab507 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
5 files checked, 1 offense detected

app/models/miq_server/log_management.rb

  • ❗ - Line 194, Col 10 - Style/SafeNavigation - Use safe navigation (&.) instead of checking if an object exists before calling the method.

Copy link
Member

@carbonin carbonin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. @bdunne anything to add?

@bdunne bdunne merged commit d868f6f into ManageIQ:master May 25, 2018
@bdunne bdunne added this to the Sprint 87 Ending Jun 4, 2018 milestone May 25, 2018
@bdunne bdunne self-assigned this May 25, 2018
@jrafanie
Copy link
Member Author

Also, mentioned in the BZ but you can disable this feature like this:

To disable this feature

You can do it in the advanced settings of each server by changing the value from true to false in log/collection/include_automate_models_and_dialogs OR by script:

bin/rails c
irb(main):001:0> MiqServer.my_server.id
=> 4253000000000001

vmdb
./tools/configure_server_settings.rb -s 4253000000000001 -p log/collection/include_automate_models_and_dialogs -v false -t boolean -f --dry-run

Confirm the changes look ok:

Change [log/collection/include_automate_models_and_dialogs], old class: [TrueClass], new class: [FalseClass]
Setting [log/collection/include_automate_models_and_dialogs], old value: [true], new value: [false]

Then run it without the dry run option to set it:

./tools/configure_server_settings.rb -s 4253000000000001 -p log/collection/include_automate_models_and_dialogs -v false -t boolean -f

This can be scripted for all servers by doing something like this:

bin/rails c

> MiqServer.all.each {|s| `#{Rails.root.join("tools", "configure_server_settings.rb")} -s #{s.id} -p log/collection/include_automate_models_and_dialogs -v false -t boolean -f` }

@jrafanie jrafanie deleted the upload_automate_models_dialogs_during_log_collection branch May 25, 2018 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants