Code Monkey home page Code Monkey logo

Comments (3)

detailedschematic avatar detailedschematic commented on June 12, 2024

Just wanted to note that I was able to map NAA IDs to Windows disk numbers in Chef. I used Chef's powershell_out() function to execute Powershell code inside a Chef recipe, and used the output string with some logic to determine the disk number supplied to the xDisk DSC resource.

In that way, I was able to completely and reliably automate the LUN/disk configuration process using DSC with Chef - awesome! Since my original issue is resolved with that workaround, I don't mind if this issue is closed.

from storagedsc.

Zuldan avatar Zuldan commented on June 12, 2024

@detailedschematic, if possible, could you kindly share with us your Chef/Powershell code so we can see the full solution?

from storagedsc.

detailedschematic avatar detailedschematic commented on June 12, 2024

Sorry for the delay. I've pasted a snippet from my Chef recipe below.

A here-doc string contains powershell code:
naaid_to_disknum = <<-code $disk = Get-Disk -UniqueId #{naaid}; return $disk.number code

We call that powershell code in Chef using powershell_out() inside a dsc_resource resource. We use lazy attribute evaluation to delay until the execution phase of convergence:
dsc_resource "xClusterDisk" do resource :xClusterDisk property :Ensure, 'Present' property :Label, label property :Number, lazy { powershell_out(naaid_to_disknum).stdout.chop.to_s } end

from storagedsc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.