summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-04-12 10:46:29 -0400
committerScott Moser <smoser@ubuntu.com>2016-04-12 10:46:29 -0400
commit2b3f56294576998246e13f9b07074bad7b4bf212 (patch)
tree5b13a3c61328472084ae2fd2f177e0e23863597b /cloudinit
parent7122f7d6fac6eb78922a474facfd9d439d1bf5b6 (diff)
downloadvyos-cloud-init-2b3f56294576998246e13f9b07074bad7b4bf212.tar.gz
vyos-cloud-init-2b3f56294576998246e13f9b07074bad7b4bf212.zip
provide a warning if 'system' but file does not exist
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/config/cc_chef.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/cloudinit/config/cc_chef.py b/cloudinit/config/cc_chef.py
index 07dacb0c..6ecaf8db 100644
--- a/cloudinit/config/cc_chef.py
+++ b/cloudinit/config/cc_chef.py
@@ -209,8 +209,13 @@ def handle(name, cfg, cloud, log, _args):
vcert = chef_cfg.get('validation_cert')
# special value 'system' means do not overwrite the file
# but still render the template to contain 'validation_key'
- if vcert and vcert != "system":
- util.write_file(vkey_path, vcert)
+ if vcert:
+ if vcert != "system":
+ util.write_file(vkey_path, vcert)
+ elif not os.path.isfile(vkey_path):
+ log.warn("chef validation_cert provided as 'system', but "
+ "validation_key path '%s' does not exist.",
+ vkey_path)
# Create the chef config from template
template_fn = cloud.get_template_filename('chef_client.rb')