summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2020-06-08 15:43:24 -0400
committerGitHub <noreply@github.com>2020-06-08 13:43:24 -0600
commit4e534a7c22514d162e65cc773d44b706fe877cea (patch)
treeae12e23e4da452fe62f06d92cb45821444c06281 /cloudinit
parentb36b61debe1556f6dfd2d7ff61fa7bd6b3335fa0 (diff)
downloadvyos-cloud-init-4e534a7c22514d162e65cc773d44b706fe877cea.tar.gz
vyos-cloud-init-4e534a7c22514d162e65cc773d44b706fe877cea.zip
Replace cc_chef is_installed with use of subp.is_exe. (#421)
This was brought up in review of #416. Makes sense to remove the local copy of "is this executable file".
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/config/cc_chef.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/cloudinit/config/cc_chef.py b/cloudinit/config/cc_chef.py
index e1f51fce..f8c22bcb 100644
--- a/cloudinit/config/cc_chef.py
+++ b/cloudinit/config/cc_chef.py
@@ -145,14 +145,6 @@ CHEF_EXEC_PATH = '/usr/bin/chef-client'
CHEF_EXEC_DEF_ARGS = tuple(['-d', '-i', '1800', '-s', '20'])
-def is_installed():
- if not os.path.isfile(CHEF_EXEC_PATH):
- return False
- if not os.access(CHEF_EXEC_PATH, os.X_OK):
- return False
- return True
-
-
def post_run_chef(chef_cfg, log):
delete_pem = util.get_cfg_option_bool(chef_cfg,
'delete_validation_post_exec',
@@ -257,9 +249,10 @@ def handle(name, cfg, cloud, log, _args):
# Try to install chef, if its not already installed...
force_install = util.get_cfg_option_bool(chef_cfg,
'force_install', default=False)
- if not is_installed() or force_install:
+ installed = subp.is_exe(CHEF_EXEC_PATH)
+ if not installed or force_install:
run = install_chef(cloud, chef_cfg, log)
- elif is_installed():
+ elif installed:
run = util.get_cfg_option_bool(chef_cfg, 'exec', default=False)
else:
run = False