Skip to content

Commit 5af0968

Browse files
author
Gabriel Monroy
committed
stop using sudo in chef setup
1 parent 15a71a8 commit 5af0968

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

cm/chef.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
# read the client key
4545
_client_pem_path = os.path.join(CHEF_CONFIG_PATH, 'client.pem')
4646
CHEF_CLIENT_KEY = subprocess.check_output(
47-
['sudo', '/bin/cat', _client_pem_path]).strip('\n')
47+
['/bin/cat', _client_pem_path]).strip('\n')
4848
# read the validation key
4949
_valid_pem_path = os.path.join(CHEF_CONFIG_PATH, 'validation.pem')
5050
CHEF_VALIDATION_KEY = subprocess.check_output(
51-
['sudo', '/bin/cat', _valid_pem_path]).strip('\n')
51+
['/bin/cat', _valid_pem_path]).strip('\n')
5252
except Exception as err:
5353
msg = "Failed to auto-configure Chef -- {}".format(err)
5454
if os.environ.get('READTHEDOCS'):
@@ -90,6 +90,7 @@ def bootstrap_node(node):
9090
f.write(node['ssh_private_key'])
9191
# build knife bootstrap command
9292
args = ['knife', 'bootstrap', node['fqdn']]
93+
args.extend(['--config', '/etc/chef/client.rb'])
9394
args.extend(['--identity-file', pk_path])
9495
args.extend(['--node-name', node['id']])
9596
args.extend(['--sudo', '--ssh-user', node['ssh_username']])
@@ -158,13 +159,14 @@ def converge_controller():
158159
159160
:returns: the output of the convergence command, in this case `sudo chef-client`
160161
"""
161-
try:
162-
# we only need to run the gitosis recipe to update `git push` ACLs
163-
return subprocess.check_output(['sudo', 'chef-client', '-o', 'recipe[deis::gitosis]'])
164-
except subprocess.CalledProcessError as err:
165-
print(err)
166-
print(err.output)
167-
raise err
162+
#try:
163+
# # we only need to run the gitosis recipe to update `git push` ACLs
164+
# return subprocess.check_output(['sudo', 'chef-client', '-o', 'recipe[deis::gitosis]'])
165+
#except subprocess.CalledProcessError as err:
166+
# print(err)
167+
# print(err.output)
168+
# raise err
169+
pass # TODO: replace this with new key lookup
168170

169171

170172
def converge_node(node):

0 commit comments

Comments
 (0)