)]}'
{"nova/tests/unit/volume/encryptors/test_luks.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f51977c82e75ef92c69cea15476c16a895204b28","unresolved":false,"context_lines":[{"line_number":26,"context_line":"        return luks.LuksEncryptor(connection_info)"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"    def setUp(self):"},{"line_number":29,"context_line":"        super(LuksEncryptorTestCase, self).setUp()"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    @mock.patch(\u0027nova.utils.execute\u0027)"},{"line_number":32,"context_line":"    def test_is_luks(self, mock_execute):"}],"source_content_type":"text/x-python","patch_set":8,"id":"1a930d6b_87dbde7a","line":29,"updated":"2015-01-26 23:31:26.000000000","message":"above is not needed :)","commit_id":"54892209cbd34253f577bdc9f870d55083ddabc8"},{"author":{"_account_id":2750,"name":"Sean Dague","email":"sean@dague.net","username":"sdague"},"change_message_id":"e9d38eb33903b944f8018eca83e422c8be1347fd","unresolved":false,"context_lines":[{"line_number":26,"context_line":"        return luks.LuksEncryptor(connection_info)"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"    def setUp(self):"},{"line_number":29,"context_line":"        super(LuksEncryptorTestCase, self).setUp()"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    @mock.patch(\u0027nova.utils.execute\u0027)"},{"line_number":32,"context_line":"    def test_is_luks(self, mock_execute):"}],"source_content_type":"text/x-python","patch_set":8,"id":"1a930d6b_02cefc2d","line":29,"in_reply_to":"1a930d6b_87dbde7a","updated":"2015-01-27 00:22:10.000000000","message":"agreed, I\u0027ll put it a follow up","commit_id":"54892209cbd34253f577bdc9f870d55083ddabc8"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"f1bb6485ef690ec18369e25a5ad05cdb6798e377","unresolved":false,"context_lines":[{"line_number":95,"context_line":""},{"line_number":96,"context_line":"        self.encryptor.attach_volume(None)"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"        mock_execute.assert_has_calls(["},{"line_number":99,"context_line":"            mock.call(\u0027cryptsetup\u0027, \u0027luksOpen\u0027, \u0027--key-file\u003d-\u0027, self.dev_path,"},{"line_number":100,"context_line":"                      self.dev_name, process_input\u003d\u00270\u0027 * 32,"},{"line_number":101,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue),"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_985cd2ef","line":98,"updated":"2014-12-16 02:00:07.000000000","message":"The assert_has_calls here seem very heavy, i.e. the unit test is just making sure the code is doing exactly what we know it\u0027s doing today, so whenever someone changes the code, the test has to be updated to assert the same thing.","commit_id":"54892209cbd34253f577bdc9f870d55083ddabc8"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"304f9a5e1b2c6433ab42ce9077fdc00d46fe3aaf","unresolved":false,"context_lines":[{"line_number":95,"context_line":""},{"line_number":96,"context_line":"        self.encryptor.attach_volume(None)"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"        mock_execute.assert_has_calls(["},{"line_number":99,"context_line":"            mock.call(\u0027cryptsetup\u0027, \u0027luksOpen\u0027, \u0027--key-file\u003d-\u0027, self.dev_path,"},{"line_number":100,"context_line":"                      self.dev_name, process_input\u003d\u00270\u0027 * 32,"},{"line_number":101,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue),"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_77526936","line":98,"in_reply_to":"3a961159_985cd2ef","updated":"2015-01-05 15:07:08.000000000","message":"Yes, because that to me is the best way to ensure that cryptsetup is being invoked correctly. A nightmare scenario would be the case that cryptsetup fails for some reason but the device is still attached to the VM (e.g., due to incorrect handling of an exception at some point), which means that the device is not encrypted even though the user thinks that it is encrypted. The problem with transparent encryption is that the user has no effective way to verify that it\u0027s working correctly, which is why the tests are so specific.\n\nI\u0027m open to alternatives if there\u0027s a better way to structure these tests. On the plus side, I doubt that the individual encryptors should change very much so \u0027heavyweight\u0027 unit tests shouldn\u0027t impose too much maintenance burden.","commit_id":"54892209cbd34253f577bdc9f870d55083ddabc8"},{"author":{"_account_id":7746,"name":"Dan Genin","email":"daniel.genin@jhuapl.edu","username":"DiG"},"change_message_id":"28e8b2d51f1469664ae75c1f181e5d35602c5fa5","unresolved":false,"context_lines":[{"line_number":111,"context_line":"                      \u0027/dev/mapper/%s\u0027 % self.dev_name, self.symlink_path,"},{"line_number":112,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue),"},{"line_number":113,"context_line":"        ], any_order\u003dFalse)"},{"line_number":114,"context_line":"        self.assertEqual(5, mock_execute.call_count)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    @mock.patch(\u0027nova.utils.execute\u0027)"},{"line_number":117,"context_line":"    def test_attach_volume_fail(self, mock_execute):"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_1988a521","line":114,"updated":"2014-12-17 17:49:05.000000000","message":"Given the previous check, this is redundant.","commit_id":"54892209cbd34253f577bdc9f870d55083ddabc8"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"304f9a5e1b2c6433ab42ce9077fdc00d46fe3aaf","unresolved":false,"context_lines":[{"line_number":111,"context_line":"                      \u0027/dev/mapper/%s\u0027 % self.dev_name, self.symlink_path,"},{"line_number":112,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue),"},{"line_number":113,"context_line":"        ], any_order\u003dFalse)"},{"line_number":114,"context_line":"        self.assertEqual(5, mock_execute.call_count)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    @mock.patch(\u0027nova.utils.execute\u0027)"},{"line_number":117,"context_line":"    def test_attach_volume_fail(self, mock_execute):"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_972a75e5","line":114,"in_reply_to":"3a961159_1988a521","updated":"2015-01-05 15:07:08.000000000","message":"According to the docs, there could be additional calls either before or after the ones checked by assert_has_calls -- see https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock.assert_has_calls So this assertion ensures that we know exactly what was called.","commit_id":"54892209cbd34253f577bdc9f870d55083ddabc8"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f51977c82e75ef92c69cea15476c16a895204b28","unresolved":false,"context_lines":[{"line_number":111,"context_line":"                      \u0027/dev/mapper/%s\u0027 % self.dev_name, self.symlink_path,"},{"line_number":112,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue),"},{"line_number":113,"context_line":"        ], any_order\u003dFalse)"},{"line_number":114,"context_line":"        self.assertEqual(5, mock_execute.call_count)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    @mock.patch(\u0027nova.utils.execute\u0027)"},{"line_number":117,"context_line":"    def test_attach_volume_fail(self, mock_execute):"}],"source_content_type":"text/x-python","patch_set":8,"id":"1a930d6b_070c4eec","line":114,"in_reply_to":"3a961159_972a75e5","updated":"2015-01-26 23:31:26.000000000","message":"Joel is correct.","commit_id":"54892209cbd34253f577bdc9f870d55083ddabc8"},{"author":{"_account_id":7746,"name":"Dan Genin","email":"daniel.genin@jhuapl.edu","username":"DiG"},"change_message_id":"28e8b2d51f1469664ae75c1f181e5d35602c5fa5","unresolved":false,"context_lines":[{"line_number":134,"context_line":"            mock.call(\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027, self.dev_path,"},{"line_number":135,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue),"},{"line_number":136,"context_line":"        ], any_order\u003dFalse)"},{"line_number":137,"context_line":"        self.assertEqual(2, mock_execute.call_count)"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"    @mock.patch(\u0027nova.utils.execute\u0027)"},{"line_number":140,"context_line":"    def test__close_volume(self, mock_execute):"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_198fc524","line":137,"updated":"2014-12-17 17:49:05.000000000","message":"Same here.","commit_id":"54892209cbd34253f577bdc9f870d55083ddabc8"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"304f9a5e1b2c6433ab42ce9077fdc00d46fe3aaf","unresolved":false,"context_lines":[{"line_number":134,"context_line":"            mock.call(\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027, self.dev_path,"},{"line_number":135,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue),"},{"line_number":136,"context_line":"        ], any_order\u003dFalse)"},{"line_number":137,"context_line":"        self.assertEqual(2, mock_execute.call_count)"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"    @mock.patch(\u0027nova.utils.execute\u0027)"},{"line_number":140,"context_line":"    def test__close_volume(self, mock_execute):"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_b72db1ff","line":137,"in_reply_to":"3a961159_198fc524","updated":"2015-01-05 15:07:08.000000000","message":"See comment above.","commit_id":"54892209cbd34253f577bdc9f870d55083ddabc8"}],"nova/tests/volume/encryptors/test_luks.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"195ea132841ef6e0d176cd6cdd8649104ab0bc0c","unresolved":false,"context_lines":[{"line_number":89,"context_line":"            is_luks(*args)"},{"line_number":90,"context_line":"            return fake_is_luks.ret_value"},{"line_number":91,"context_line":"        fake_is_luks.ret_value \u003d False"},{"line_number":92,"context_line":"        self.stubs.Set(luks, \u0027is_luks\u0027, fake_is_luks)"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"        self.encryptor.attach_volume(None)"},{"line_number":95,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_983747e3","line":92,"updated":"2014-09-30 18:55:44.000000000","message":"This is really kind of odd... I think it would be easiest to just use mock.patch() on the test method instead of jumping through these hoops. AFAICT, you can rewrite this test method \u0027s code up to this point to just be this:\n\n @mock.patch(\u0027utils.execute\u0027)\n def test_attach_volume(self, mock_exec):\n      self.stubs.Set(self.encryptor, \u0027_get_key\u0027,\n                     test_cryptsetup.fake__get_key)\n      expected_calls \u003d [\n          mock.call(\u0027cryptsetup\u0027, \u0027luksOpen\u0027, \u0027--key-file\u003d-\u0027,\n                    self.dev_path, self.dev_name),\n          mock.call(\u0027ln\u0027, \u0027--symbolic\u0027, \u0027--force\u0027,\n                    \u0027/dev/mapper/%s\u0027 % self.dev_name,\n                    self.symlink_path)\n      ]\n      self.encryptor.attach_volume(None)\n      self.assertEqual(expected_calls, mock_exec.call_args_list)\n\nThe depending on what you want the `cryptsetup isLuks --verbose` execute call to do, create another test method like so:\n\n @mock.patch.object(luks, \u0027is_luks\u0027, return_value\u003dFalse)\n @mock.patch(\u0027utils.execute\u0027)\n def test_attach_volume_is_not_luks(self, mock_exec, mock_is_luks)\n     self.stubs.Set(self.encryptor, \u0027_get_key\u0027,\n                    test_cryptsetup.fake__get_key)\n     expected_calls \u003d [\n        mock.call(\u0027cryptsetup\u0027, \u0027luksOpen\u0027, \u0027--key-file\u003d-\u0027,\n                  self.dev_path, self.dev_name),\n        ...\n     ]\n     self.encryptor.attach_volume(None)\n     self.assertEqual(expected_calls, mock_exec.call_args_list)\n     mock_is_luks.assert_called_once_with()","commit_id":"c149282981c03e9e5e57a8b508ec892f3ccd77f0"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"2ec55cf031ecde56c299a5d2d71e8f02c42b3ac3","unresolved":false,"context_lines":[{"line_number":89,"context_line":"            is_luks(*args)"},{"line_number":90,"context_line":"            return fake_is_luks.ret_value"},{"line_number":91,"context_line":"        fake_is_luks.ret_value \u003d False"},{"line_number":92,"context_line":"        self.stubs.Set(luks, \u0027is_luks\u0027, fake_is_luks)"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"        self.encryptor.attach_volume(None)"},{"line_number":95,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_9c97c68f","line":92,"in_reply_to":"baa201ad_983747e3","updated":"2014-10-06 19:01:47.000000000","message":"So I tried to rewrite the tests via mock.patch, but I had trouble because I really want to check that the system calls (e.g., `cryptsetup luksOpen ...`) are correct. I found that I could either log all the system calls or I could introduce side effects (such as a ProcessExecutionError for _open_volume) but not both. If there\u0027s a way to achieve both effects, then I\u0027m happy to update the patch.\n\nOtherwise, I could rewrite all the unit tests for the encryptors to follow the mock.patch paradigm, but I\u0027d rather do that as part of a follow-up patch.","commit_id":"c149282981c03e9e5e57a8b508ec892f3ccd77f0"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"195ea132841ef6e0d176cd6cdd8649104ab0bc0c","unresolved":false,"context_lines":[{"line_number":118,"context_line":"                              self.dev_path, self.dev_name),"},{"line_number":119,"context_line":"                             (\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027,"},{"line_number":120,"context_line":"                              self.dev_path)]"},{"line_number":121,"context_line":"        self.assertEqual(expected_commands, self.executes)"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"    def test__close_volume(self):"},{"line_number":124,"context_line":"        self.encryptor.detach_volume()"}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_b8340bdf","line":121,"updated":"2014-09-30 18:55:44.000000000","message":"I agree with Dan here that it\u0027s more common to handle the failure cases in a separate test method.","commit_id":"c149282981c03e9e5e57a8b508ec892f3ccd77f0"},{"author":{"_account_id":7746,"name":"Dan Genin","email":"daniel.genin@jhuapl.edu","username":"DiG"},"change_message_id":"63599d25b3b15e79b7fd512998f1f7af75d469a7","unresolved":false,"context_lines":[{"line_number":118,"context_line":"                              self.dev_path, self.dev_name),"},{"line_number":119,"context_line":"                             (\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027,"},{"line_number":120,"context_line":"                              self.dev_path)]"},{"line_number":121,"context_line":"        self.assertEqual(expected_commands, self.executes)"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"    def test__close_volume(self):"},{"line_number":124,"context_line":"        self.encryptor.detach_volume()"}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_f231520c","line":121,"updated":"2014-09-30 18:17:59.000000000","message":"I think it is more common to separate the failure scenarios into a separate test, usually called something like ..._negative(), e.g., test_attach_volume_negative().","commit_id":"c149282981c03e9e5e57a8b508ec892f3ccd77f0"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"2ec55cf031ecde56c299a5d2d71e8f02c42b3ac3","unresolved":false,"context_lines":[{"line_number":118,"context_line":"                              self.dev_path, self.dev_name),"},{"line_number":119,"context_line":"                             (\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027,"},{"line_number":120,"context_line":"                              self.dev_path)]"},{"line_number":121,"context_line":"        self.assertEqual(expected_commands, self.executes)"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"    def test__close_volume(self):"},{"line_number":124,"context_line":"        self.encryptor.detach_volume()"}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_9c6986c0","line":121,"in_reply_to":"baa201ad_b8340bdf","updated":"2014-10-06 19:01:47.000000000","message":"Done","commit_id":"c149282981c03e9e5e57a8b508ec892f3ccd77f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"08465cae4689a2f11d517deed1e0aeef505e5819","unresolved":false,"context_lines":[{"line_number":32,"context_line":"    def _create(self, connection_info):"},{"line_number":33,"context_line":"        return luks.LuksEncryptor(connection_info)"},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"    def setUp(self):"},{"line_number":36,"context_line":"        super(LuksEncryptorTestCase, self).setUp()"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"    def test_is_luks(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"baa201ad_73ed21b7","line":35,"updated":"2014-10-14 16:32:43.000000000","message":"This method isn\u0027t necessary if it\u0027s not doing anything but calling the parent class.","commit_id":"ce5714f1849b1f680287268dbc4aafe2824c1c28"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"08465cae4689a2f11d517deed1e0aeef505e5819","unresolved":false,"context_lines":[{"line_number":40,"context_line":""},{"line_number":41,"context_line":"        expected_commands \u003d [(\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027,"},{"line_number":42,"context_line":"                              self.dev_path)]"},{"line_number":43,"context_line":"        self.assertEqual(expected_commands, self.executes)"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    def test__format_volume(self):"},{"line_number":46,"context_line":"        self.encryptor._format_volume(\"passphrase\")"}],"source_content_type":"text/x-python","patch_set":4,"id":"baa201ad_7349a1b6","line":43,"updated":"2014-10-14 16:32:43.000000000","message":"This is weird, I expected to see a mock, but it\u0027s handled in the parent CryptsetupEncryptorTestCase.","commit_id":"ce5714f1849b1f680287268dbc4aafe2824c1c28"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"129e1b6b4fa667bcd9190d20107606cd57e0ce6e","unresolved":false,"context_lines":[{"line_number":40,"context_line":""},{"line_number":41,"context_line":"        expected_commands \u003d [(\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027,"},{"line_number":42,"context_line":"                              self.dev_path)]"},{"line_number":43,"context_line":"        self.assertEqual(expected_commands, self.executes)"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    def test__format_volume(self):"},{"line_number":46,"context_line":"        self.encryptor._format_volume(\"passphrase\")"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_6b927058","line":43,"in_reply_to":"baa201ad_7349a1b6","updated":"2014-12-02 19:43:56.000000000","message":"Done","commit_id":"ce5714f1849b1f680287268dbc4aafe2824c1c28"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"08465cae4689a2f11d517deed1e0aeef505e5819","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        self.assertEqual(expected_commands, self.executes)"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def test_attach_volume_is_not_luks_formatted(self):"},{"line_number":73,"context_line":"        self.stubs.Set(self.encryptor, \u0027_get_key\u0027,"},{"line_number":74,"context_line":"                       test_cryptsetup.fake__get_key)"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"        def fake__open_volume(*args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":4,"id":"baa201ad_53e57da6","line":73,"updated":"2014-10-14 16:32:43.000000000","message":"Would really prefer that we use mock for new tests.","commit_id":"ce5714f1849b1f680287268dbc4aafe2824c1c28"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"129e1b6b4fa667bcd9190d20107606cd57e0ce6e","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        self.assertEqual(expected_commands, self.executes)"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def test_attach_volume_is_not_luks_formatted(self):"},{"line_number":73,"context_line":"        self.stubs.Set(self.encryptor, \u0027_get_key\u0027,"},{"line_number":74,"context_line":"                       test_cryptsetup.fake__get_key)"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"        def fake__open_volume(*args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_cba1a4aa","line":73,"in_reply_to":"baa201ad_53e57da6","updated":"2014-12-02 19:43:56.000000000","message":"Done","commit_id":"ce5714f1849b1f680287268dbc4aafe2824c1c28"}],"nova/volume/encryptors/luks.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"1508b3cd62e10d51fcf6505d2c59e2148ab500de","unresolved":false,"context_lines":[{"line_number":25,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"def isLUKS(device):"},{"line_number":29,"context_line":"    \"\"\"Checks if the specified device uses LUKS for encryption."},{"line_number":30,"context_line":"    "},{"line_number":31,"context_line":"    :param device: the device to check"}],"source_content_type":"text/x-python","patch_set":1,"id":"baa201ad_f147b01b","line":28,"updated":"2014-09-29 17:25:30.000000000","message":"I think our function naming would have this function be \"is_luks\" or \"is_LUKS\", instead of the camel-cased isLUKS...","commit_id":"801a423adae234b79aaecb95d1228e56b07694f7"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"d5540b9bf00ee2c8e2d87c185ac58b89fee6cee6","unresolved":false,"context_lines":[{"line_number":25,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"def isLUKS(device):"},{"line_number":29,"context_line":"    \"\"\"Checks if the specified device uses LUKS for encryption."},{"line_number":30,"context_line":"    "},{"line_number":31,"context_line":"    :param device: the device to check"}],"source_content_type":"text/x-python","patch_set":1,"id":"baa201ad_a236b501","line":28,"in_reply_to":"baa201ad_f147b01b","updated":"2014-09-29 21:55:44.000000000","message":"Done","commit_id":"801a423adae234b79aaecb95d1228e56b07694f7"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"1508b3cd62e10d51fcf6505d2c59e2148ab500de","unresolved":false,"context_lines":[{"line_number":36,"context_line":"        utils.execute(\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027, device,"},{"line_number":37,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue)"},{"line_number":38,"context_line":"        return True"},{"line_number":39,"context_line":"    except processutils.ProcessExecutionError as e:"},{"line_number":40,"context_line":"        return False"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"baa201ad_115514c6","line":39,"updated":"2014-09-29 17:25:30.000000000","message":"So the `cryptsetup isLuks --verbose \u003cdevice\u003e` command returns a non-zero exit code if the device does not use LUKS? That seems a bit odd. I would have thought the command would return 0 but print \"0\" or \"false\".\n\nLooks like http://linux.derkeiler.com/Newsgroups/comp.os.linux.misc/2012-08/msg00011.html shows that indeed cryptsetup isLuks returns a non-zero return code if the volume is not LUKS, so this will indeed work. Just seems counter-intuititve :) You may want to add a code comment line above the execute() call that says basically \"hey, I know this looks weird, but cryptsetup isLuks really does return a non-zero exit code when the device is not LUKS...\"","commit_id":"801a423adae234b79aaecb95d1228e56b07694f7"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"d5540b9bf00ee2c8e2d87c185ac58b89fee6cee6","unresolved":false,"context_lines":[{"line_number":36,"context_line":"        utils.execute(\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027, device,"},{"line_number":37,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue)"},{"line_number":38,"context_line":"        return True"},{"line_number":39,"context_line":"    except processutils.ProcessExecutionError as e:"},{"line_number":40,"context_line":"        return False"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"baa201ad_e240bd58","line":39,"in_reply_to":"baa201ad_115514c6","updated":"2014-09-29 21:55:44.000000000","message":"Done","commit_id":"801a423adae234b79aaecb95d1228e56b07694f7"},{"author":{"_account_id":8412,"name":"Mike Durnosvistov","email":"glacierr.dev@gmail.com","username":"mdurnosvistov"},"change_message_id":"e4cde20b6d90fae3aef326b364c6e62ea4c13e7f","unresolved":false,"context_lines":[{"line_number":102,"context_line":"        except processutils.ProcessExecutionError as e:"},{"line_number":103,"context_line":"            if e.exit_code \u003d\u003d 1 and not is_luks(self.dev_path):"},{"line_number":104,"context_line":"                # the device has never been formatted; format it and try again"},{"line_number":105,"context_line":"                LOG.info(_(\"%s is not a valid LUKS device;\""},{"line_number":106,"context_line":"                           \" formatting device for first use\"),"},{"line_number":107,"context_line":"                         self.dev_path)"},{"line_number":108,"context_line":"                self._format_volume(passphrase, **kwargs)"}],"source_content_type":"text/x-python","patch_set":2,"id":"baa201ad_c231e7a3","line":105,"range":{"start_line":105,"start_character":24,"end_line":105,"end_character":27},"updated":"2014-09-30 14:06:37.000000000","message":"Please use `_LI` here.","commit_id":"51fff633a5e0030481f11a5e9cf5b9de76b236b4"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"4c72e1eacfb233c8f2d54ca2fce6a8cc63006e2b","unresolved":false,"context_lines":[{"line_number":102,"context_line":"        except processutils.ProcessExecutionError as e:"},{"line_number":103,"context_line":"            if e.exit_code \u003d\u003d 1 and not is_luks(self.dev_path):"},{"line_number":104,"context_line":"                # the device has never been formatted; format it and try again"},{"line_number":105,"context_line":"                LOG.info(_(\"%s is not a valid LUKS device;\""},{"line_number":106,"context_line":"                           \" formatting device for first use\"),"},{"line_number":107,"context_line":"                         self.dev_path)"},{"line_number":108,"context_line":"                self._format_volume(passphrase, **kwargs)"}],"source_content_type":"text/x-python","patch_set":2,"id":"baa201ad_41e892b4","line":105,"in_reply_to":"baa201ad_c231e7a3","updated":"2014-09-30 16:15:06.000000000","message":"Done","commit_id":"51fff633a5e0030481f11a5e9cf5b9de76b236b4"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d000149a068e46a40d1fdcb3149ddf6f4c514ecf","unresolved":false,"context_lines":[{"line_number":33,"context_line":"    try:"},{"line_number":34,"context_line":"        # check to see if the device uses LUKS: exit status is 0"},{"line_number":35,"context_line":"        # if the device is a LUKS partition and 1 if not"},{"line_number":36,"context_line":"        utils.execute(\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027, device,"},{"line_number":37,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue)"},{"line_number":38,"context_line":"        return True"},{"line_number":39,"context_line":"    except processutils.ProcessExecutionError:"}],"source_content_type":"text/x-python","patch_set":4,"id":"baa201ad_e36bfcb6","line":36,"updated":"2014-10-14 19:43:44.000000000","message":"Do we need a rootwrap filter for the isLuks call or do we just have one for cryptsetup already?","commit_id":"ce5714f1849b1f680287268dbc4aafe2824c1c28"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"08465cae4689a2f11d517deed1e0aeef505e5819","unresolved":false,"context_lines":[{"line_number":33,"context_line":"    try:"},{"line_number":34,"context_line":"        # check to see if the device uses LUKS: exit status is 0"},{"line_number":35,"context_line":"        # if the device is a LUKS partition and 1 if not"},{"line_number":36,"context_line":"        utils.execute(\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027, device,"},{"line_number":37,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue)"},{"line_number":38,"context_line":"        return True"},{"line_number":39,"context_line":"    except processutils.ProcessExecutionError:"}],"source_content_type":"text/x-python","patch_set":4,"id":"baa201ad_93ba85df","line":36,"updated":"2014-10-14 16:32:43.000000000","message":"Why is --verbose needed?","commit_id":"ce5714f1849b1f680287268dbc4aafe2824c1c28"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"129e1b6b4fa667bcd9190d20107606cd57e0ce6e","unresolved":false,"context_lines":[{"line_number":33,"context_line":"    try:"},{"line_number":34,"context_line":"        # check to see if the device uses LUKS: exit status is 0"},{"line_number":35,"context_line":"        # if the device is a LUKS partition and 1 if not"},{"line_number":36,"context_line":"        utils.execute(\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027, device,"},{"line_number":37,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue)"},{"line_number":38,"context_line":"        return True"},{"line_number":39,"context_line":"    except processutils.ProcessExecutionError:"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_cb88c424","line":36,"in_reply_to":"baa201ad_93ba85df","updated":"2014-12-02 19:43:56.000000000","message":"It provides some debugging output if the command fails. (Not that we\u0027re doing anything with it at the moment.)","commit_id":"ce5714f1849b1f680287268dbc4aafe2824c1c28"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"129e1b6b4fa667bcd9190d20107606cd57e0ce6e","unresolved":false,"context_lines":[{"line_number":33,"context_line":"    try:"},{"line_number":34,"context_line":"        # check to see if the device uses LUKS: exit status is 0"},{"line_number":35,"context_line":"        # if the device is a LUKS partition and 1 if not"},{"line_number":36,"context_line":"        utils.execute(\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027, device,"},{"line_number":37,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue)"},{"line_number":38,"context_line":"        return True"},{"line_number":39,"context_line":"    except processutils.ProcessExecutionError:"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_6b79902e","line":36,"in_reply_to":"baa201ad_e36bfcb6","updated":"2014-12-02 19:43:56.000000000","message":"The existing one for cryptsetup is sufficient.","commit_id":"ce5714f1849b1f680287268dbc4aafe2824c1c28"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"08465cae4689a2f11d517deed1e0aeef505e5819","unresolved":false,"context_lines":[{"line_number":104,"context_line":"                # the device has never been formatted; format it and try again"},{"line_number":105,"context_line":"                LOG.info(_LI(\"%s is not a valid LUKS device;\""},{"line_number":106,"context_line":"                             \" formatting device for first use\"),"},{"line_number":107,"context_line":"                         self.dev_path)"},{"line_number":108,"context_line":"                self._format_volume(passphrase, **kwargs)"},{"line_number":109,"context_line":"                self._open_volume(passphrase, **kwargs)"},{"line_number":110,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"baa201ad_33c9d979","line":107,"updated":"2014-10-14 16:32:43.000000000","message":"Would self.dev_name be better here?","commit_id":"ce5714f1849b1f680287268dbc4aafe2824c1c28"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"129e1b6b4fa667bcd9190d20107606cd57e0ce6e","unresolved":false,"context_lines":[{"line_number":104,"context_line":"                # the device has never been formatted; format it and try again"},{"line_number":105,"context_line":"                LOG.info(_LI(\"%s is not a valid LUKS device;\""},{"line_number":106,"context_line":"                             \" formatting device for first use\"),"},{"line_number":107,"context_line":"                         self.dev_path)"},{"line_number":108,"context_line":"                self._format_volume(passphrase, **kwargs)"},{"line_number":109,"context_line":"                self._open_volume(passphrase, **kwargs)"},{"line_number":110,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_4bf8547c","line":107,"in_reply_to":"baa201ad_33c9d979","updated":"2014-12-02 19:43:56.000000000","message":"I don\u0027t think it makes much difference in this case. The dev_path identifies the specific device (e.g., /dev/sd?) whereas the dev_name includes iSCSI information. The latter could be more difficult to debug in isolation \u0027cause you\u0027d need to map it to the device.","commit_id":"ce5714f1849b1f680287268dbc4aafe2824c1c28"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"f1bb6485ef690ec18369e25a5ad05cdb6798e377","unresolved":false,"context_lines":[{"line_number":33,"context_line":"    \"\"\""},{"line_number":34,"context_line":"    try:"},{"line_number":35,"context_line":"        # check to see if the device uses LUKS: exit status is 0"},{"line_number":36,"context_line":"        # if the device is a LUKS partition and 1 if not"},{"line_number":37,"context_line":"        utils.execute(\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027, device,"},{"line_number":38,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue)"},{"line_number":39,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_1851c2d8","line":36,"updated":"2014-12-16 02:00:07.000000000","message":"Would it be better if we checked the exit code of 1 rather than just blanket assume any ProcessExecutionError means it\u0027s not a LUKS device?\n\nFor example, luksDump apparently exits with 234 if it\u0027s not a LUKS device:\n\nhttps://bugs.launchpad.net/ubuntu/+source/cryptsetup/+bug/488704","commit_id":"54892209cbd34253f577bdc9f870d55083ddabc8"},{"author":{"_account_id":2750,"name":"Sean Dague","email":"sean@dague.net","username":"sdague"},"change_message_id":"e9d38eb33903b944f8018eca83e422c8be1347fd","unresolved":false,"context_lines":[{"line_number":33,"context_line":"    \"\"\""},{"line_number":34,"context_line":"    try:"},{"line_number":35,"context_line":"        # check to see if the device uses LUKS: exit status is 0"},{"line_number":36,"context_line":"        # if the device is a LUKS partition and 1 if not"},{"line_number":37,"context_line":"        utils.execute(\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027, device,"},{"line_number":38,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue)"},{"line_number":39,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":8,"id":"1a930d6b_82002c35","line":36,"in_reply_to":"1a930d6b_c7eb26da","updated":"2015-01-27 00:22:10.000000000","message":"We\u0027ll get a message from the execute block, so it\u0027s probably fine.","commit_id":"54892209cbd34253f577bdc9f870d55083ddabc8"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"304f9a5e1b2c6433ab42ce9077fdc00d46fe3aaf","unresolved":false,"context_lines":[{"line_number":33,"context_line":"    \"\"\""},{"line_number":34,"context_line":"    try:"},{"line_number":35,"context_line":"        # check to see if the device uses LUKS: exit status is 0"},{"line_number":36,"context_line":"        # if the device is a LUKS partition and 1 if not"},{"line_number":37,"context_line":"        utils.execute(\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027, device,"},{"line_number":38,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue)"},{"line_number":39,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_975fd574","line":36,"in_reply_to":"3a961159_1851c2d8","updated":"2015-01-05 15:07:08.000000000","message":"My assumption is that any non-zero exit status indicates that it isn\u0027t a LUKS device -- i.e., 0 \u003d\u003e LUKS and anything else (which raises a ProcessExecutionError) is not LUKS. Perhaps I should clean up the comment to avoid any confusion?","commit_id":"54892209cbd34253f577bdc9f870d55083ddabc8"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f51977c82e75ef92c69cea15476c16a895204b28","unresolved":false,"context_lines":[{"line_number":33,"context_line":"    \"\"\""},{"line_number":34,"context_line":"    try:"},{"line_number":35,"context_line":"        # check to see if the device uses LUKS: exit status is 0"},{"line_number":36,"context_line":"        # if the device is a LUKS partition and 1 if not"},{"line_number":37,"context_line":"        utils.execute(\u0027cryptsetup\u0027, \u0027isLuks\u0027, \u0027--verbose\u0027, device,"},{"line_number":38,"context_line":"                      run_as_root\u003dTrue, check_exit_code\u003dTrue)"},{"line_number":39,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":8,"id":"1a930d6b_c7eb26da","line":36,"in_reply_to":"3a961159_975fd574","updated":"2015-01-26 23:31:26.000000000","message":"The only thing I\u0027d recommend here would be to LOG.debug() or maybe LOG.warn() below in the except block to log the actual return code and sys.stdout that was returned?","commit_id":"54892209cbd34253f577bdc9f870d55083ddabc8"}]}
