diff options
Diffstat (limited to 'cloudinit/apport.py')
-rw-r--r-- | cloudinit/apport.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cloudinit/apport.py b/cloudinit/apport.py index 92068aa9..aa3a6c5c 100644 --- a/cloudinit/apport.py +++ b/cloudinit/apport.py @@ -3,6 +3,7 @@ # This file is part of cloud-init. See LICENSE file for license information. """Cloud-init apport interface""" +from cloudinit.cmd.devel import read_cfg_paths try: from apport.hookutils import ( @@ -53,7 +54,11 @@ KNOWN_CLOUD_NAMES = [ # Potentially clear text collected logs CLOUDINIT_LOG = "/var/log/cloud-init.log" CLOUDINIT_OUTPUT_LOG = "/var/log/cloud-init-output.log" -USER_DATA_FILE = "/var/lib/cloud/instance/user-data.txt" # Optional + + +def _get_user_data_file() -> str: + paths = read_cfg_paths() + return paths.get_ipath_cur("userdata_raw") def attach_cloud_init_logs(report, ui=None): @@ -106,18 +111,19 @@ def attach_cloud_info(report, ui=None): def attach_user_data(report, ui=None): """Optionally provide user-data if desired.""" if ui: + user_data_file = _get_user_data_file() prompt = ( "Your user-data or cloud-config file can optionally be provided" " from {0} and could be useful to developers when addressing this" " bug. Do you wish to attach user-data to this bug?".format( - USER_DATA_FILE + user_data_file ) ) response = ui.yesno(prompt) if response is None: raise StopIteration # User cancelled if response: - attach_file(report, USER_DATA_FILE, "user_data.txt") + attach_file(report, user_data_file, "user_data.txt") def add_bug_tags(report): |