oneops-admin/lib/shared/cookbooks/artifact/libraries/chef_artifact.rb
def data_bag_config_for(node, source)
        data_bag_item = if node[:data_bag]
          node[:data_bag][DATA_BAG] rescue {}
        elsif Chef::Config[:solo]
          Chef::DataBagItem.load(DATA_BAG, WILDCARD_DATABAG_ITEM) rescue {}
        else
          encrypted_data_bag_for(node, DATA_BAG)
        end

        # support new format
        return data_bag_item[source] if data_bag_item.has_key?(source)

        # backwards compatible for old data bag formats using nexus
        return data_bag_item if DATA_BAG_NEXUS == source

        return data_bag_item[DATA_BAG_NEXUS] if data_bag_item.has_key?(DATA_BAG_NEXUS)
        
        # no config found for source
        {}
      end
# Loads the encrypted data bag item and returns credentials
# for the environment or for a default key.
#
# @param  node [Chef::Node] the Chef node
# @param  source [String] the deployment source to load configuration for
# 
# @return [Chef::DataBagItem] the data bag item
Loads the encrypted data bag item and returns credentials
for the environment or for a default key.
Loads the encrypted data bag item and returns credentials for the environment or for a default key .
def data_bag_config_for(node, source)
        data_bag_item = if node[:data_bag]
          node[:data_bag][DATA_BAG] rescue {}
        elsif Chef::Config[:solo]
          Chef::DataBagItem.load(DATA_BAG, WILDCARD_DATABAG_ITEM) rescue {}
        else
          encrypted_data_bag_for(node, DATA_BAG)
        end
        return data_bag_item[source] if data_bag_item.has_key?(source)
        return data_bag_item if DATA_BAG_NEXUS == source
        return data_bag_item[DATA_BAG_NEXUS] if data_bag_item.has_key?(DATA_BAG_NEXUS)
        {}
      end
def data_bag_config_for ( node , source ) data_bag_item = if node [ :data_bag ] node [ :data_bag ] [ DATA_BAG ] rescue { } elsif Chef :: Config [ :solo ] Chef :: DataBagItem . load ( DATA_BAG , WILDCARD_DATABAG_ITEM ) rescue { } else encrypted_data_bag_for ( node , DATA_BAG ) end return data_bag_item [ source ] if data_bag_item . has_key? ( source ) return data_bag_item if DATA_BAG_NEXUS == source return data_bag_item [ DATA_BAG_NEXUS ] if data_bag_item . has_key? ( DATA_BAG_NEXUS ) { } end
Loads the encrypted data bag item and returns credentials
for the environment or for a default key.
Loads the encrypted data bag item and returns credentials for the environment or for a default key .
# support new format # backwards compatible for old data bag formats using nexus # no config found for source
the data bag item
the data bag item
Chef::DataBagItem
node
the Chef node
the Chef node
source
the deployment source to load configuration for
the deployment source to load configuration for