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

[W.I.P] Dev docs for Inspec::Backend #6831

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Vasu1105
Copy link
Contributor

@Vasu1105 Vasu1105 commented Oct 25, 2023

Description

Dev docs to understand

  • What is InSpec::Backend?
  • Where is the backend used?
  • What is the mock backend?

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New content (non-breaking change)
  • Breaking change (a content change which would break existing functionality or processes)

Checklist:

  • I have read the CONTRIBUTING document.

@netlify
Copy link

netlify bot commented Oct 25, 2023

Deploy Preview for chef-inspec canceled.

Name Link
🔨 Latest commit b30726c
🔍 Latest deploy log https://app.netlify.com/sites/chef-inspec/deploys/653a566a6ce69c0008d9a692

@Vasu1105 Vasu1105 changed the title Dev docs for understand Inspec::Backend [W.I.p} Dev docs for understand Inspec::Backend Oct 25, 2023
@Vasu1105 Vasu1105 changed the title [W.I.p} Dev docs for understand Inspec::Backend [W.I.P] Dev docs for understand Inspec::Backend Oct 25, 2023
@Vasu1105 Vasu1105 changed the title [W.I.P] Dev docs for understand Inspec::Backend [W.I.P] Dev docs for Inspec::Backend Oct 25, 2023
* identify the target operating system via os
* authenticate to API-based services and treat them like a platform

When inspec exec command is run with --target option it establishes the connection to that target using speficifed transport like ssh, winrm etc. By default it uses local transport if the --target is not provided. Backend class is responsible for creating this transprot and establish connection using train.
Copy link
Contributor

Choose a reason for hiding this comment

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

You should probably mention that tran transports are plugins - gems that can be externally loaded and maintained outside of InSpec and Train.

## Mock backend

Mock is used primarily for testing and debugging. This is used to create a dummy connection.
InSpec use Mock backend in unit testing environment and some places in code base where backend object is required but it does not require for any real time connection or execution of commands. For example inspec export, check, archive are some of the cli commands uses mock bockend as it required by profile object( https://github.com/inspec/inspec/blob/main/lib/inspec/config.rb#L187) else if not provided it creates the backend with local(https://github.com/inspec/inspec/blob/main/lib/inspec/config.rb#L187) transport which is not required for export, check and archive.
Copy link
Contributor

Choose a reason for hiding this comment

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

When writing devdocs, use permalink URLs - line 187 may change over time.

Comment on lines +29 to +30
It call unpack_train_credentials of config.rb which returns the hash containing backend, logger and few more details
example
Copy link
Contributor

Choose a reason for hiding this comment

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

Try to explain at the level of intent. "Why" is it doing that. Why is important that it does what it is doing. Highlight the important parts and omit the routine parts. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants