databags

Encrypt data bag from inside of ruby without relying on knife

好久不见. 提交于 2019-12-31 03:41:19
问题 At the moment to encrypt a data bag, I have to do : system "knife data bag from file TemporaryEncrypting \"#{enc_file_path}\" --secret-file #{Secret_Key_Path}" and that doesn't work because knife can't find a config file and I can't seem to get it read the one in C:\chef . How do I do this from within ruby? 回答1: I worked out how to encrypt inside of ruby, just use this code: require 'chef/knife' #require 'chef/encrypted_data_bag_item' #you need to do this in chef version 12, they've moved it

Joining both hashsets together

假装没事ソ 提交于 2019-12-13 08:32:46
问题 My aim is to create a database like code where i add planets and the year they are found, and once the user inputs planets it shows all the planets and the year they are found, so far i have created this. import java.util.HashSet; import java.util.Scanner; import java.lang.*; public class sky { public static void main(String args[]) { Scanner in = new Scanner(System.in); // HashSet declaration HashSet < String > planet = new HashSet < String > (); // Adding elements to the HashSet planet.add(

Chef Data Bags and dynamic variable passing

人走茶凉 提交于 2019-12-11 12:49:45
问题 I am trying to figure out a way to get the below code work; I have tried various methods but the chef-client run breaks at the 3rd line. lsf = "#{node[:env]}"+"_ls" dsf = "#{node[:env]}"+"_ds" dsTemplateBag = data_bag_item('configTemplates', "#{dsf}") lcTemplateBag = data_bag_item('configTemplates', "#{lsf}") However on another test recipe I was able to successfully get the following working: env = "test" dsTemplateBag = data_bag_item('configTemplates', "#{env}") I am quite new to Chef and

How to specify a data bag path in knife.rb configuration file?

心不动则不痛 提交于 2019-12-11 08:44:22
问题 I have data bags specific to different clients like the following: /data_bags/client1/users/.... /data_bags/client1/projects/.... /data_bags/client2/users/... /data_bags/client2/projects/... So, client1 and client2 have a different set of projects and users, but me as a developer it's better if all the configurations are under folder. I work on them, then when they are production ready, I want to push them to chef server to provision the nodes. But knife.rb expects all the data bags to be

Chef attributes versus data bags

冷暖自知 提交于 2019-12-03 08:31:28
问题 I'm new to Chef, and after reading the documentation I'm still having trouble understanding when to use Attributes and when to use Data bags. What kind of data should be stored as attributes, and what kind of data should be stored in data bags ? Thanks 回答1: Well, it depends. Although data bags and attributes both hold data, the major difference between them is that attributes are exposed as node properties when recipe is run, but you don't have any clear overview what data bags were used

Chef attributes versus data bags

£可爱£侵袭症+ 提交于 2019-12-02 22:23:09
I'm new to Chef, and after reading the documentation I'm still having trouble understanding when to use Attributes and when to use Data bags. What kind of data should be stored as attributes, and what kind of data should be stored in data bags ? Thanks Well, it depends. Although data bags and attributes both hold data, the major difference between them is that attributes are exposed as node properties when recipe is run, but you don't have any clear overview what data bags were used (Except that you go through the recipes in run list). What I personally store in attributes are: Paths where

Encrypt data bag from inside of ruby without relying on knife

落花浮王杯 提交于 2019-12-01 23:02:11
At the moment to encrypt a data bag, I have to do : system "knife data bag from file TemporaryEncrypting \"#{enc_file_path}\" --secret-file #{Secret_Key_Path}" and that doesn't work because knife can't find a config file and I can't seem to get it read the one in C:\chef . How do I do this from within ruby? I worked out how to encrypt inside of ruby, just use this code: require 'chef/knife' #require 'chef/encrypted_data_bag_item' #you need to do this in chef version 12, they've moved it out of knife and into it's own section require 'json' secret = Chef::EncryptedDataBagItem.load_secret Secret