Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloudinit tests fail when running as root #3368

Closed
ubuntu-server-builder opened this issue May 11, 2023 · 2 comments
Closed

cloudinit tests fail when running as root #3368

ubuntu-server-builder opened this issue May 11, 2023 · 2 comments
Labels
enhancement New feature or request launchpad Migrated from Launchpad

Comments

@ubuntu-server-builder
Copy link
Collaborator

This bug was originally filed in Launchpad as LP: #1825027

Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = 2022-02-15T21:54:15.102125+00:00
date_created = 2019-04-16T17:40:17.955388+00:00
date_fix_committed = 2022-02-15T21:54:15.102125+00:00
date_fix_released = 2022-02-15T21:54:15.102125+00:00
id = 1825027
importance = wishlist
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1825027
milestone = None
owner = vtqanh
owner_name = Anh Vo (MSFT)
private = False
status = fix_released
submitter = vtqanh
submitter_name = Anh Vo (MSFT)
tags = []
duplicates = []

Launchpad user Anh Vo (MSFT)(vtqanh) wrote on 2019-04-16T17:40:17.955388+00:00

The tests under cloudinit/cmd/tests/test_query.py will fail if run as root.

sudo nosetests3 test_query.py --debug=query

query: WARNING: Missing root-readable /tmp/ci-TestQuery.0ztjrur1/run_dir/instance-data-sensitive.json. Using redacted /tmp/ci-TestQuery.0ztjrur1/run_dir/instance-data.json instead.
query: ERROR: Missing instance-data file: /tmp/ci-TestQuery.0ztjrur1/run_dir/instance-data.json
.Equery: ERROR: Missing instance-data file: /tmp/ci-TestQuery.2_qzzunv/absent
.query: ERROR: Expected one of the options: --all, --format, --list-keys or varname
.query: ERROR: No read permission on '/tmp/ci-TestQuery.faxmaofy/unreadable'. Try sudo
.EEEEEEquery: WARNING: Missing root-readable /tmp/ci-TestQuery.rhy7l_rq/run_dir/instance-data-sensitive.json. Using redacted /tmp/ci-TestQuery.rhy7l_rq/run_dir/instance-data.json instead.
query: ERROR: Missing instance-data file: /tmp/ci-TestQuery.rhy7l_rq/run_dir/instance-data.json
..

ERROR: cloudinit.cmd.tests.test_query.TestQuery.test_handle_args_dumps_all_instance_data

Traceback (most recent call last):
File "/home/anhvo/repos/cloud-init/cloudinit/cmd/tests/test_query.py", line 153, in test_handle_args_dumps_all_instance_data
self.assertEqual(0, query.handle_args('anyname', args))
File "/home/anhvo/repos/cloud-init/cloudinit/cmd/query.py", line 124, in handle_args
instance_data['userdata'] = util.load_file(user_data_fn)
File "/home/anhvo/repos/cloud-init/cloudinit/util.py", line 1359, in load_file
with open(fname, 'rb') as ifh:
FileNotFoundError: [Errno 2] No such file or directory: 'ud'

======================================================================
ERROR: cloudinit.cmd.tests.test_query.TestQuery.test_handle_args_list_keys_errors_when_varname_is_not_a_dict

Traceback (most recent call last):
File "/home/anhvo/repos/cloud-init/cloudinit/cmd/tests/test_query.py", line 255, in test_handle_args_list_keys_errors_when_varname_is_not_a_dict
self.assertEqual(1, query.handle_args('anyname', args))
File "/home/anhvo/repos/cloud-init/cloudinit/cmd/query.py", line 124, in handle_args
instance_data['userdata'] = util.load_file(user_data_fn)
File "/home/anhvo/repos/cloud-init/cloudinit/util.py", line 1359, in load_file
with open(fname, 'rb') as ifh:
FileNotFoundError: [Errno 2] No such file or directory: 'ud'

@ubuntu-server-builder ubuntu-server-builder added enhancement New feature or request launchpad Migrated from Launchpad labels May 11, 2023
@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Ryan Harper(raharper) wrote on 2019-07-18T21:16:46.948541+00:00

Hi, thanks for the bug. We generally want to avoid running any tests as root so as not to modify anything sensitive on the host.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Brett Holman(holmanb) wrote on 2022-02-15T21:54:15.976730+00:00

This bug is believed to be fixed in cloud-init in version 22.1. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request launchpad Migrated from Launchpad
Projects
None yet
Development

No branches or pull requests

1 participant