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

5050 self._CreateSudoersGroup()
5151 self.groups = groups.split(',') if groups else []
5252 self.groups.append(self.google_sudoers_group)
53- self.groups = filter(self._GetGroup, self.groups)
53+ self.groups = list(filter(self._GetGroup, self.groups))
5454 self.remove = remove
5555
5656 def _GetGroup(self, group):
140140 Returns:
141141 bool, True if user update succeeded.
142142 """
143+ groups = ','.join(groups)
143144 self.logger.debug('Updating user %s with groups %s.', user, groups)
144- command = ['usermod', '-G', ','.join(groups), user]
145+ command = ['usermod', '-G', groups, user]
145146 try:
146147 subprocess.check_call(command)
147148 except subprocess.CalledProcessError as e:

The check that tells the two apart

failpass·google_compute_engine/accounts/tests/accounts_utils_test.py::AccountsUtilsTest::testUpdateUserGroups
failpass·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