Ask Your Question
0

Is the file current.mof a bottleneck when using the DSC module?

asked 2015-04-03 16:11:40 -0500

Paul Chernoch gravatar image

The DSC module (PowerShell Defined State Configuration) seems to have a bottleneck. Every class that uses a DSC resource generates intermediate Powershell/DSC code that creates a file called current.mof in the same directory. When I run Puppet agent --test things go screwy. It seems like one puppet class is getting information related to a different puppet class, as if it generates its MOF and then executes a different class' MOF by accident. I suppose I can find a way to chain all these resource together with dependency arrows so that they are executed serially, but then that means I can't have truly separate profile classes for each ZIP archive I am unpacking. I would prefer for one server to get classes A, B, and C, another gets B, C, etc. If I put the chaining in, then I have to duplicate a lot of code.

Am I correct about this? I am very new to PowerShell. Here is an example of a single class that pulls a ZIP file from a Web Service and then unzips it into the target location:

# This profile class installs the BookingsUI package from a URI specified in the global ::package_source variable
class phoenix_profiles::archive_test {
  $archive_file        = "BookingsUI.zip"
  $drive               = pick($::destination_drive, 'd:')
  # $staged_archive_path = "${drive}/eftours/packages/${archive_file}"
  $staged_archive_path = "${drive}/temp/puppet_archive_test/source/${archive_file}"
  dsc_xremotefile { "download ${archive_file}":
    dsc_uri => "${::package_source}/${archive_file}",
    dsc_destinationpath => $staged_archive_path
  } ->
  dsc_archive { "unpack ${archive_file}":
    dsc_ensure      => 'Present',
    dsc_validate    => "true",
    dsc_checksum    => "ModifiedDate",
    dsc_force       => "true",
    dsc_path        => $staged_archive_path,
    dsc_destination => "${drive}/temp/puppet_archive_test/BookingsUI"
  }
}
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-02-03 08:40:53 -0500

The current release of puppetlabs-dsc module does not use Start-DscConfiguration (the current.mof file you are talking about) and instead uses Invoke-DscResource. This means there is no intermediary file generated in-between executing each DSC Resource, instead a direct API call is made.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-04-03 16:11:40 -0500

Seen: 439 times

Last updated: Apr 03 '15