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

Configuration commands #3036

Merged
merged 43 commits into from
Mar 8, 2023
Merged

Configuration commands #3036

merged 43 commits into from
Mar 8, 2023

Conversation

JohnMcPMS
Copy link
Member

@JohnMcPMS JohnMcPMS commented Mar 3, 2023

Change

Adds the configuration commands configure, configure show, configure test, and configure validate (although it doesn't actually implement test or validate).

configure show outputs the configuration file that it is given, along with information on the configuration units contained within. With the current PS DSC processor implementation, an example configuration file (that doesn't actually do anything as it is missing settings):

properties:
    configurationVersion: 0.1
    resources:
      - resource: XmlFileContentResource
        directives:
          module: XmlContentDsc
          description: Set XML file contents
      - resource: SecureBoot
        directives:
          module: DellBIOSProvider
          description: Set secure boot options

is shown as:

> wingetdev configure show ShowDetails.yml
Apply :: XmlFileContentResource
  Set XML file contents
  Module: XmlContentDsc by Raimund Andree [PSGallery]
    Module with DSC Resources for managing XML file content
Apply :: SecureBoot
  Set secure boot options
  Module: DellBIOSProvider by Dell BizClient Team [PSGallery]
    The 'Dell Command | PowerShell Provider' provides native configuration capability of Dell Optiplex, Latitude, Precision, XPS Notebook and Venue 11 systems within PowerShell.

configure will first show the configuration file, then prompt the user to both review it and accept the responsibility for its actions. --accept-configuration-agreements can pre-accept the warning and apply the configuration without prompting. As the configuration is being applied, the individual results will be reported.

All of the configuration actions are run in a separate process to isolate winget.exe from a potential crash. That process is run at the same integrity level as winget.exe though, allowing elevated (admin) configuration actions.

Additionally, there are several minor fixes to things that I saw while developing this.

Validation

Currently this has only been manually validated (the command workflow; the configuration code has automated tests). Tests will be backfilled for this, but for now we are trying to get this into selfhost. As it is an experimental feature and also completely new, this seems like an acceptable, temporary state to be in.

Microsoft Reviewers: Open in CodeFlow

@JohnMcPMS JohnMcPMS requested a review from a team as a code owner March 3, 2023 06:07
@github-actions

This comment has been minimized.

@denelon
Copy link
Contributor

denelon commented Mar 3, 2023

Related to:

@@ -12,7 +12,7 @@ namespace Microsoft.Management.Configuration.UnitTests.Helpers
/// <summary>
/// A test implementation of IConfigurationProcessorFactory.
Copy link
Contributor

Choose a reason for hiding this comment

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

IConfigurationProcessorFactory

IConfigurationSetProcessorFactory

@@ -14,7 +14,7 @@ namespace Microsoft.Management.Configuration.Processor
/// ConfigurationProcessorFactory implementation. Does not support out-of-proc.
/// TODO: change to IConfigurationSetProcessorFactory.
Copy link
Contributor

Choose a reason for hiding this comment

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

delete

@@ -0,0 +1,33 @@
using Microsoft.Management.Configuration.Processor;
using System.Runtime.InteropServices;
using WinRT;
Copy link
Contributor

Choose a reason for hiding this comment

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

I know you'll hate me, but can you add stylecops :D

Copy link
Member Author

Choose a reason for hiding this comment

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

😡

@github-actions

This comment has been minimized.

@JohnMcPMS
Copy link
Member Author

As is blatantly obvious from the commit count and messages, the build server has been difficult. While I don't think that the project setup is workable for running tests on the build server yet, I think that we need to be able to carry this through to the internal build to work out the issues for selfhosting purposes. Those fixes will then be applied here and hopefully enable E2E testing to occur soon.

Since the local builds work, and this is a completely siloed experimental feature, these current shortcomings are acceptable to me.

@JohnMcPMS JohnMcPMS merged commit 73f05cd into microsoft:master Mar 8, 2023
@JohnMcPMS JohnMcPMS deleted the config-command branch March 8, 2023 22:18
@denelon
Copy link
Contributor

denelon commented Mar 8, 2023

I agree since we're working on preview for an experimental feature.

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.

3 participants