Эх сурвалжийг харах

Update and fix scrip to run as user and root

Signed-off-by: Jeremy MAURO <jeremy.mauro@gmail.com>
Jeremy MAURO 3 жил өмнө
parent
commit
39c5d2d256

+ 4 - 0
scripts/end_run.sh

@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+if [ $(id -g) -eq 0 ]; then
+	chown -Rh jeremy: policy-export
+fi

+ 0 - 1
scripts/export_policy.sh

@@ -7,5 +7,4 @@ bundle exec chef-cli update base.rb
 bundle exec chef-cli export base.rb -a policy-export
 pushd policy-export > /dev/null
 tar xfz *.tgz && rm -rf *.tgz
-#bundle exec chef-client --chef-license 'accept' -z
 popd > /dev/null

+ 20 - 0
scripts/launch_debug.sh

@@ -1,5 +1,6 @@
 #!/usr/bin/env bash
 ./scripts/export_policy.sh
+# Setup the configuration file
 cat << _EOF > policy-export/.chef/config_solo.rb
 log_level          :debug
 log_location       '/dev/null'
@@ -15,5 +16,24 @@ Mixlib::Log::Formatter.show_time = true
 _EOF
 
 cd policy-export
+mkdir -p nodes
+# Create the node
+cat << _EOF > "./nodes/$(hostname --fqdn).json"
+{
+  "name": "Thinkpad-vhdx.",
+  "chef_environment": "local",
+  "normal": {
+    "tags": [
+
+    ]
+  },
+  "run_list": [
+    "recipe[workstation::default]"
+  ],
+  "policy_name": "base",
+  "policy_group": "local"
+}
+_EOF
 bundle exec chef-shell -s -c .chef/config_solo.rb
 cd -
+./scripts/end_run.sh

+ 1 - 0
scripts/run_policy.sh

@@ -6,3 +6,4 @@
 pushd policy-export > /dev/null
 bundle exec chef-client --chef-license 'accept' -z
 popd > /dev/null
+./scripts/end_run.sh