[chef] RE: Re: Re: Deleting an element in an attribute?


Chronological Thread 
  • From: Robert Keng < >
  • To: " " < >
  • Subject: [chef] RE: Re: Re: Deleting an element in an attribute?
  • Date: Fri, 3 Feb 2012 23:07:03 +0000
  • Accept-language: en-US

Thx for the suggestions Ian/Max, will def look at using hashes instead, but was able to incorporate Max's suggestion in our recipe for now, it works great, again thanks!

-Robert

From: on behalf of Max Gorbul
Sent: Wednesday, February 01, 2012 4:20 PM
To:
Subject: [chef] Re: Re: Deleting an element in an attribute?

... or you can modify the array 

node.normal_attrs[:packages_install_specific].reject! {|p| p[0] == "libicu-devel" }

--max

On Wed, Feb 1, 2012 at 4:16 PM, Ian Marlier < " target="_blank"> > wrote:
What if you make it a hash instead of a list?

set[:packages_install_specific] = {
  "js" => "1.70-8",
  "icu" => "3.6-5.16.1",
...
}

Then you can do, eg, node.normal_attrs[:packages_install_specific].delete("js")




On Wed, Feb 1, 2012 at 7:05 PM, Robert Keng < " target="_blank"> > wrote:
I'm probably not using the right terms, but lets' say I have the following:

set[:packages_install_specific] = [
  ["js","1.70-8"],
  ["icu","3.6-5.16.1"],
  ["libicu","3.6-5.16.1"],
  ["libicu-devel","3.6-5.16.1"]
]

The attrs looks like:
{
    "normal": {
     "packages_install_specific": [
        [
          "js",
          "1.70-8"
        ],
        [
          "icu",
          "3.6-5.16.1"
        ],
        [
          "libicu",
          "3.6-5.16.1"
        ],
        [
          "libicu-devel",
          "3.6-5.16.1"
        ]
     ]

...

Is it possible to delete the tuple   ["libicu-devel","3.6-5.16.1"] programmatically in a recipe? I've tried using:

node.normal_attrs[:packages_install_specific].delete(:libicu-devel) rescue nil

But I probably can't refer to it as a key...Can someone shed some light on this? If someone can forward me to some docs I'd greatly appreciate it. Running 0.9.x (8 I believe), thanks in advance!

-Robert



--
Ian Marlier | Senior Systems Engineer
Brightcove, Inc.





Archive powered by MHonArc 2.6.16.

§