puppetlabs / ruby-pwsh

A ruby gem for interacting with PowerShell
MIT License
15 stars 23 forks source link

Provider returned data that does not match the Type Schema #205

Closed ic248 closed 6 months ago

ic248 commented 1 year ago

Describe the Bug

Multiple warnings of "Provider returned data that does not match the Type Schema for `' Unknown attribute:

Examples Warning: Provider returned data that does not match the Type Schema for dsc_ipaddress[Ethernet1] Unknown attribute:

Warning: Provider returned data that does not match the Type Schema for dsc_webapppool[ComputerName] Unknown attribute:

Warning: Provider returned data that does not match the Type Schema for dsc_webapppool[AppPool] Unknown attribute:

Expected Behavior

No warnings to appear

Environment

mod 'puppetlabs-pwshlib', '0.10.3' mod 'dsc-certificatedsc', '5.1.0-0-2' mod 'dsc-computermanagementdsc', '8.5.0-0-2' mod 'dsc-failoverclusterdsc', '2.1.0-0-1' mod 'dsc-networkingdsc', '9.0.0-0-2' mod 'dsc-psdscresources', '2.12.0-0-6' mod 'dsc-securitypolicydsc', '2.10.0-0-5' mod 'dsc-sqlserverdsc', '16.0.0-0-2' mod 'dsc-webadministrationdsc', '4.0.0-0-2'

Additional Context

Hi,

Unsure if this is the correct place but please close and repoint me in the correct direction if not. We are moving from the deprecated puppetlabs/dsc modules and are getting multiple warning each time we run Puppet with the new DSC modules.

Thanks Ian

chelnak commented 1 year ago

Hey Ian - this is the right place 😄

This is something that we are aware of and usually means that there are some discrepancies between the DSC module that our code is working with and they type that is produced.

It usually nothing to worry about.. however in this case you have given quite a few examples and that interests me somewhat.

Could you provide some example manifests that cause the issue (obviously omitting any sensitive info)? This will help us replicate the problem quickly.

Thanks!

ic248 commented 1 year ago

Hi Craig,

Thank you for getting back so quickly.

Below are some snippets of the affected manifests

Core manifests

define windows::net::interface::v4::noroute (
    String $adapter = $title,
    String $ip_address,
) {
    dsc_ipaddress {
        $adapter:
            dsc_interfacealias => $adapter,
            dsc_addressfamily => 'IPv4',
            dsc_ipaddress => [$ip_address],
            validation_mode => 'resource';
    }
}

Called via

windows::net::interface::v4::noroute {
    'Ethernet1':
        ip_address => '192.168.0.2/26';
}

Core manifests

define iis::app_pool (
    Integer $max_procs = 1,
) {
    dsc_webapppool {
        $title:
            dsc_ensure => 'Present',
            dsc_name => $title,
            dsc_state => 'Started',
            dsc_autostart => true,
            dsc_identitytype => 'ApplicationPoolIdentity',
            dsc_startmode => 'AlwaysRunning',
            dsc_maxprocesses => $max_procs,
            require => Dsc_windowsfeature['iis'],
            validation_mode => 'resource';
    }
}
define iis::app_pool (
    Integer $max_procs = 1,
) {
    dsc_webapppool {
        $title:
            dsc_ensure => 'Present',
            dsc_name => $title,
            dsc_state => 'Started',
            dsc_autostart => true,
            dsc_identitytype => 'ApplicationPoolIdentity',
            dsc_startmode => 'AlwaysRunning',
            dsc_maxprocesses => $max_procs,
            require => Dsc_windowsfeature['iis'],
            validation_mode => 'resource';
    }
}

Called via

iis::webapp {
    'WebSiteName':
        website => $fqdn,
        docroot => "${drive}:\\WebSiteName\\Name",
        require => iis::Website[$fqdn];
}

Forgot to mention this one: Warning: Provider returned data that does not match the Type Schema for dsc_cluster[cluster_name] Unknown attribute:

Core manifests

define windows::cluster::common (
    String $ip_address,
    String $admin_user,
    Sensitive $admin_pass,
) {
    include windows::cluster

    dsc_cluster {
        $title:
            dsc_name => $title,
            dsc_staticipaddress => $ip_address,
            dsc_domainadministratorcredential => {'user' => $admin_user, 'password' => $admin_pass},
            require => Dsc_windowsfeature['failover-clustering'],
            validation_mode => 'resource';
    }
}
define windows::cluster::primary (
    String $ip_address,
    String $admin_user,
    Sensitive $admin_pass,
) {
    windows::cluster::common {
        $title:
            ip_address => $ip_address,
            admin_user => $admin_user,
            admin_pass => $admin_pass;
    }
}

Called via

windows::cluster::primary {
    "ComputerName":
        ip_address =>  '192.168.0.2',
        admin_user => "Domain\\ComputerName",
        admin_pass => Sensitive('Password');

Please say if you require anything further.

Thanks

jordanbreen28 commented 6 months ago

Thanks @ic248 - Closing in favour of https://github.com/puppetlabs/ruby-pwsh/issues/278