Skip to content

Commit 459c03f

Browse files
committed
Make lintastic
1 parent cb2466f commit 459c03f

File tree

4 files changed

+230
-137
lines changed

4 files changed

+230
-137
lines changed

cookbooks/boxcutter_onepassword/kitchen.yml

Lines changed: 55 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ platforms:
5656
- RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
5757

5858
suites:
59-
- name: cli
59+
- name: cli-cinc
6060
named_run_list: boxcutter_onepassword_test_cli
6161
verifier:
6262
inspec_tests:
@@ -65,15 +65,34 @@ suites:
6565
lifecycle:
6666
pre_converge:
6767
- remote: |
68-
bash -xc '
69-
set +x
68+
bash -c '
69+
if [ -z "<%= ENV['OP_SERVICE_ACCOUNT_TOKEN'] %>" ]; then
70+
echo "OP_SERVICE_ACCOUNT_TOKEN environment variable needs to be set for testing"
71+
exit 1
72+
fi
7073
mkdir -p /etc/cinc
71-
ln -s /etc/cinc /etc/chef
74+
echo "<%= ENV['OP_SERVICE_ACCOUNT_TOKEN'] %>" > /etc/cinc/op_service_account_token
75+
'
76+
77+
- name: cli-chef
78+
named_run_list: boxcutter_onepassword_test_cli
79+
verifier:
80+
inspec_tests:
81+
- test/integration/cli
82+
attributes:
83+
lifecycle:
84+
pre_converge:
85+
- remote: |
86+
bash -c '
87+
if [ -z "<%= ENV['OP_SERVICE_ACCOUNT_TOKEN'] %>" ]; then
88+
echo "OP_SERVICE_ACCOUNT_TOKEN environment variable needs to be set for testing"
89+
exit 1
90+
fi
91+
mkdir -p /etc/chef
7292
echo "<%= ENV['OP_SERVICE_ACCOUNT_TOKEN'] %>" > /etc/chef/op_service_account_token
73-
set -x
7493
'
7594
76-
- name: service-account
95+
- name: service-account-cinc
7796
named_run_list: boxcutter_onepassword_test_service_account
7897
verifier:
7998
inspec_tests:
@@ -85,15 +104,37 @@ suites:
85104
# export OP_SERVICE_ACCOUNT_TOKEN=$(op read 'op://Automation-Org/mzqlddelxv6oe7dfz3vc7iad7m/credential' --account PB5KE5S2ORAQTDUOLBDJTLAPVU)
86105
pre_converge:
87106
- remote: |
88-
bash -xc '
89-
set +x
107+
bash -c '
108+
if [ -z "<%= ENV['OP_SERVICE_ACCOUNT_TOKEN'] %>" ]; then
109+
echo "OP_SERVICE_ACCOUNT_TOKEN environment variable needs to be set for testing"
110+
exit 1
111+
fi
90112
mkdir -p /etc/cinc
91-
ln -s /etc/cinc /etc/chef
113+
echo "<%= ENV['OP_SERVICE_ACCOUNT_TOKEN'] %>" > /etc/cinc/op_service_account_token
114+
'
115+
116+
- name: service-account-chef
117+
named_run_list: boxcutter_onepassword_test_service_account
118+
verifier:
119+
inspec_tests:
120+
- test/integration/cli
121+
attributes:
122+
lifecycle:
123+
# op item get 'Service Account Auth Token: automation-org-readonly-blue' --vault Automation-Org --account PB5KE5S2ORAQTDUOLBDJTLAPVU
124+
# op item get mzqlddelxv6oe7dfz3vc7iad7m --vault Automation-Org --account PB5KE5S2ORAQTDUOLBDJTLAPVU --format json
125+
# export OP_SERVICE_ACCOUNT_TOKEN=$(op read 'op://Automation-Org/mzqlddelxv6oe7dfz3vc7iad7m/credential' --account PB5KE5S2ORAQTDUOLBDJTLAPVU)
126+
pre_converge:
127+
- remote: |
128+
bash -c '
129+
if [ -z "<%= ENV['OP_SERVICE_ACCOUNT_TOKEN'] %>" ]; then
130+
echo "OP_SERVICE_ACCOUNT_TOKEN environment variable needs to be set for testing"
131+
exit 1
132+
fi
133+
mkdir -p /etc/chef
92134
echo "<%= ENV['OP_SERVICE_ACCOUNT_TOKEN'] %>" > /etc/chef/op_service_account_token
93-
set -x
94135
'
95136
96-
- name: connect-server
137+
- name: connect-server-cinc
97138
named_run_list: boxcutter_onepassword_test_connect_server
98139
verifier:
99140
inspec_tests:
@@ -114,9 +155,8 @@ suites:
114155
bash -xc '
115156
set +x
116157
mkdir -p /etc/cinc
117-
ln -s /etc/cinc /etc/chef
118-
echo "<%= ENV['OP_CONNECT_HOST'] %>" > /etc/chef/op_connect_host
119-
echo "<%= ENV['OP_CONNECT_TOKEN'] %>" > /etc/chef/op_connect_token
120-
echo "<%= ENV['OP_SERVICE_ACCOUNT_TOKEN'] %>" > /etc/chef/op_service_account_token
158+
echo "<%= ENV['OP_CONNECT_HOST'] %>" > /etc/cinc/op_connect_host
159+
echo "<%= ENV['OP_CONNECT_TOKEN'] %>" > /etc/cinc/op_connect_token
160+
echo "<%= ENV['OP_SERVICE_ACCOUNT_TOKEN'] %>" > /etc/cinc/op_service_account_token
121161
set -x
122162
'

0 commit comments

Comments
 (0)