Whole file
GoogleCloudPlatform/compute-image-packages
The author described this change as “Fix user account management on Python 3. (#327)”. It counts as a record because the checks below fail on the code as it stood at 04bb5dbd5 and pass on 23facf2c1, with nothing else changed between the two runs.
Fix saved2016-08-22
Sharing licenceApache-2.0 · LICENSE
Change size+3 −2
What the code was meant to do, written into the code itself as a save note
Fix user account management on Python 3. (#327)
The change
| 50 | 50 | self._CreateSudoersGroup() | |
| 51 | 51 | self.groups = groups.split(',') if groups else [] | |
| 52 | 52 | self.groups.append(self.google_sudoers_group) | |
| 53 | - | self.groups = filter(self._GetGroup, self.groups) | |
| 53 | + | self.groups = list(filter(self._GetGroup, self.groups)) | |
| 54 | 54 | self.remove = remove | |
| 55 | 55 | ||
| 56 | 56 | def _GetGroup(self, group): | |
| ⋯ | |||
| 140 | 140 | Returns: | |
| 141 | 141 | bool, True if user update succeeded. | |
| 142 | 142 | """ | |
| 143 | + | groups = ','.join(groups) | |
| 143 | 144 | self.logger.debug('Updating user %s with groups %s.', user, groups) | |
| 144 | - | command = ['usermod', '-G', ','.join(groups), user] | |
| 145 | + | command = ['usermod', '-G', groups, user] | |
| 145 | 146 | try: | |
| 146 | 147 | subprocess.check_call(command) | |
| 147 | 148 | except subprocess.CalledProcessError as e: | |
The check that tells the two apart
fail→pass·google_compute_engine/accounts/tests/accounts_utils_test.py::AccountsUtilsTest::testUpdateUserGroups
fail→pass·google_compute_engine/accounts/tests/accounts_utils_test.py::AccountsUtilsTest::testUpdateUserGroupsError
Check file google_compute_engine/accounts/tests/accounts_utils_test.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it04bb5dbd5e284770c3aa7ddefacd6a489cebfef8
Broken version dated2016-08-19
Modulegoogle_compute_engine.accounts.accounts_utils
Units changedAccountsUtils
Fingerprint1a72e659f2ee6452
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in GoogleCloudPlatform/compute-image-packages
- 2017-08-16Fix the group and user modification commands. (#460)
- 2016-08-26IpForwardingUtils