Class: Kitsune::Kit::Workflows::SupportBundle
- Inherits:
-
Object
- Object
- Kitsune::Kit::Workflows::SupportBundle
- Defined in:
- lib/kitsune/kit/workflows/support_bundle.rb
Constant Summary collapse
- MAX_LOG_FILES =
5- MAX_LOG_LINES =
500
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(root:, config:, state_store:, doctor:, secret_filter: SecretFilter.new, clock: -> { Time.now.utc }) ⇒ SupportBundle
constructor
A new instance of SupportBundle.
Constructor Details
#initialize(root:, config:, state_store:, doctor:, secret_filter: SecretFilter.new, clock: -> { Time.now.utc }) ⇒ SupportBundle
Returns a new instance of SupportBundle.
17 18 19 20 21 22 23 24 25 |
# File 'lib/kitsune/kit/workflows/support_bundle.rb', line 17 def initialize(root:, config:, state_store:, doctor:, secret_filter: SecretFilter.new, clock: -> { Time.now.utc }) @root = Pathname(root). @config = config @state_store = state_store @doctor = doctor @secret_filter = secret_filter @clock = clock end |
Instance Method Details
#call ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/kitsune/kit/workflows/support_bundle.rb', line 27 def call directory = root.join(".kitsune/support") FileUtils.mkdir_p(directory, mode: 0o700) path = directory.join("#{clock.call.strftime('%Y%m%dT%H%M%S')}-#{SecureRandom.hex(4)}.json") path.write(JSON.pretty_generate(secret_filter.filter(payload)) << "\n") File.chmod(0o600, path) path.to_s end |