From 73c898d91d5e22b42fd05ab9f95a8182a739d0c4 Mon Sep 17 00:00:00 2001 From: omesser Date: Wed, 6 Jan 2021 04:30:25 +0200 Subject: [PATCH 01/10] M --- manof/image.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/manof/image.py b/manof/image.py index b0505e0..de93642 100644 --- a/manof/image.py +++ b/manof/image.py @@ -430,6 +430,10 @@ def _add_device_arguments(self, command): if self.device_write_iops: command += '--device-write-iops={0} '.format(self.device_write_iops) + # set restart policy + if self.restart: + command += '--restart={0} '.format(self.restart) + return command @property @@ -727,6 +731,10 @@ def device_write_iops(self): return None + @property + def restart(self): + return None + def to_dict(self): d = super(Image, self).to_dict() for idx, item in enumerate(d['volumes']): From ba43fe06a83693f96e83a9ce27a0f9cfcc8cdec7 Mon Sep 17 00:00:00 2001 From: omesser Date: Sat, 8 Jan 2022 23:46:21 +0200 Subject: [PATCH 02/10] M --- .../runConfigurations/_it__basic_commands.xml | 16 +- .../runConfigurations/_it__shell_commands.xml | 18 +- .idea/runConfigurations/_ut__manof.xml | 16 +- Makefile | 2 +- manof/image.py | 10 +- .../shell_commands/artifacts/manofest.py | 21 ++- .../shell_commands/test_shell_commands.py | 169 +++++++++++------- 7 files changed, 171 insertions(+), 81 deletions(-) diff --git a/.idea/runConfigurations/_it__basic_commands.xml b/.idea/runConfigurations/_it__basic_commands.xml index 7972fa2..f9e8241 100644 --- a/.idea/runConfigurations/_it__basic_commands.xml +++ b/.idea/runConfigurations/_it__basic_commands.xml @@ -1,14 +1,24 @@ - + \ No newline at end of file diff --git a/.idea/runConfigurations/_ut__manof.xml b/.idea/runConfigurations/_ut__manof.xml index bd29efb..2711c37 100644 --- a/.idea/runConfigurations/_ut__manof.xml +++ b/.idea/runConfigurations/_ut__manof.xml @@ -1,14 +1,24 @@ - + diff --git a/.idea/runConfigurations/_it__shell_commands.xml b/.idea/runConfigurations/_it__shell_commands.xml index 4309834..376c432 100644 --- a/.idea/runConfigurations/_it__shell_commands.xml +++ b/.idea/runConfigurations/_it__shell_commands.xml @@ -1,6 +1,6 @@ - + - \ No newline at end of file + diff --git a/.idea/runConfigurations/_ut__manof.xml b/.idea/runConfigurations/_ut__manof.xml index 2711c37..0bdcc06 100644 --- a/.idea/runConfigurations/_ut__manof.xml +++ b/.idea/runConfigurations/_ut__manof.xml @@ -1,6 +1,6 @@ - + - \ No newline at end of file + diff --git a/tests/integration/_trial_temp.lock b/tests/integration/_trial_temp.lock new file mode 120000 index 0000000..79d76a0 --- /dev/null +++ b/tests/integration/_trial_temp.lock @@ -0,0 +1 @@ +55494 \ No newline at end of file From ea7751bf9d850a090b7f3d0c77302433e159fb0b Mon Sep 17 00:00:00 2001 From: omesser Date: Sat, 8 Jan 2022 23:50:30 +0200 Subject: [PATCH 04/10] M --- tests/integration/_trial_temp.lock | 1 - 1 file changed, 1 deletion(-) delete mode 120000 tests/integration/_trial_temp.lock diff --git a/tests/integration/_trial_temp.lock b/tests/integration/_trial_temp.lock deleted file mode 120000 index 79d76a0..0000000 --- a/tests/integration/_trial_temp.lock +++ /dev/null @@ -1 +0,0 @@ -55494 \ No newline at end of file From a7510fe65176fc6c4013f867ef9627b0b64d3220 Mon Sep 17 00:00:00 2001 From: omesser Date: Sat, 8 Jan 2022 23:52:28 +0200 Subject: [PATCH 05/10] comment change --- tests/integration/cases/shell_commands/test_shell_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/cases/shell_commands/test_shell_commands.py b/tests/integration/cases/shell_commands/test_shell_commands.py index 8d98e1c..abb86de 100644 --- a/tests/integration/cases/shell_commands/test_shell_commands.py +++ b/tests/integration/cases/shell_commands/test_shell_commands.py @@ -102,7 +102,7 @@ def test_images_run_and_rm(self): # run the image using manof yield self._execute_manof_command('run', [image_name]) - # check the image exists + # check the container exists docker_log_output, _, _ = yield manof.utils.execute( 'docker logs {0}'.format(image_name), cwd=None, From 7d30d7a8c1eced3300dfa94620fcd77be49c8fe8 Mon Sep 17 00:00:00 2001 From: omesser Date: Mon, 19 Feb 2024 17:02:06 +0200 Subject: [PATCH 06/10] Minor changes --- pyproject.toml | 10 ++++++---- .../cases/shell_commands/test_shell_commands.py | 12 ++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 09c5ccf..85ee4d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,11 @@ # please keep this to a minimum - defaults are good [tool.black] exclude = ''' -/( +^/( # anchor to the root + ( # exclude these directories \.git - | \.venv - | \venv -)/ + | \.venv + | venv + )/ +) ''' diff --git a/tests/integration/cases/shell_commands/test_shell_commands.py b/tests/integration/cases/shell_commands/test_shell_commands.py index abb86de..283c24f 100644 --- a/tests/integration/cases/shell_commands/test_shell_commands.py +++ b/tests/integration/cases/shell_commands/test_shell_commands.py @@ -38,19 +38,19 @@ def test_run_verify_md5(self): self.assertEqual('4a738101122b28baae05fac7a5dc6b32', run_md5) # run again and make ensure md5 has changed due to "--dummy" value change - yield self._manof_command('run', ['--dummy', 'else', target_name]) + yield self._manof_command('run', ['--dummy', 'value', target_name]) command_sha = yield manof.utils.get_running_container_label( target_name, label_name, self._logger ) run_md5, _, _ = yield self._manof_command( - 'run', ['--print-run-md5-only', '--dummy', 'else', target_name] + 'run', ['--print-run-md5-only', '--dummy', 'value', target_name] ) self.assertEqual('a3ada1db9e167a8a747c8ddd4de63757', command_sha) self.assertEqual('a3ada1db9e167a8a747c8ddd4de63757', run_md5) # different dummy data yields different run md5 run_md5, _, _ = yield self._manof_command( - 'run', ['--print-run-md5-only', '--dummy', 'else2', target_name] + 'run', ['--print-run-md5-only', '--dummy', 'value2', target_name] ) self.assertNotEqual(run_md5, command_sha) @@ -91,7 +91,7 @@ def test_run_verify_md5(self): self.assertNotEqual(run_md5, command_sha) @defer.inlineCallbacks - def test_images_run_and_rm(self): + def test_image_run_and_rm(self): self._logger.info('Testing run command happy flow') for image_name in ['test_image', 'test_image2']: @@ -127,7 +127,7 @@ def test_images_run_and_rm(self): ) @defer.inlineCallbacks - def test_images_provision(self): + def test_image_provision(self): self._logger.info('Testing provision images happy flow') for image_name, class_name in [ @@ -152,7 +152,7 @@ def test_images_provision(self): ) @defer.inlineCallbacks - def test_images_lift(self): + def test_image_lift(self): self._logger.info('Testing provision images happy flow') for image_name, class_name in [ From ebca8ed0e99658d720007c30542a28fc3ff48b51 Mon Sep 17 00:00:00 2001 From: omesser Date: Thu, 29 Feb 2024 00:44:47 +0200 Subject: [PATCH 07/10] pyproject details and python pinning in install script --- install | 2 +- pyproject.toml | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/install b/install index 93a9e10..d3f208c 100755 --- a/install +++ b/install @@ -53,7 +53,7 @@ def main(): # (from a local dir if it exists) # "python -m pip install" instead of "pip install" handles a pip # issue where it fails in a long-named dir - run('virtualenv --python=python3 venv && ' + run('virtualenv --python=python3.7 venv && ' 'source venv/bin/activate && ' 'python -m pip install {0} incremental && '.format(local_pip_packages) + 'python -m pip install {0} -r {1}'.format(local_pip_packages, requirements_file)) diff --git a/pyproject.toml b/pyproject.toml index 85ee4d3..41c90a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,14 @@ +[project] +name = 'manof' +requires-python = ">=3.7,<3.8" +version = "0.1.2" +authors = [ + {name = "Your Name", email = "you@yourdomain.com"}, +] + +[tool.setuptools] +py-modules = [] + # please keep this to a minimum - defaults are good [tool.black] exclude = ''' From e3771b85d49e3cb3ecdc0209e882157244e16aaf Mon Sep 17 00:00:00 2001 From: omesser Date: Thu, 29 Feb 2024 01:10:25 +0200 Subject: [PATCH 08/10] shell commands test fix, and make them neat please --- .../shell_commands/test_shell_commands.py | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/integration/cases/shell_commands/test_shell_commands.py b/tests/integration/cases/shell_commands/test_shell_commands.py index 283c24f..06f0186 100644 --- a/tests/integration/cases/shell_commands/test_shell_commands.py +++ b/tests/integration/cases/shell_commands/test_shell_commands.py @@ -26,30 +26,30 @@ def test_run_verify_md5(self): # run twice to ensure md5 won't change between runs for _ in range(2): - yield self._manof_command('run', ['--dummy', 'do', target_name]) + yield self._execute_manof_command('run', ['--dummy', 'do', target_name]) command_sha = yield manof.utils.get_running_container_label( target_name, label_name, self._logger ) self.assertEqual('4a738101122b28baae05fac7a5dc6b32', command_sha) - run_md5, _, _ = yield self._manof_command( + run_md5, _, _ = yield self._execute_manof_command( 'run', ['--print-run-md5-only', '--dummy', 'do', target_name] ) self.assertEqual('4a738101122b28baae05fac7a5dc6b32', run_md5) # run again and make ensure md5 has changed due to "--dummy" value change - yield self._manof_command('run', ['--dummy', 'value', target_name]) + yield self._execute_manof_command('run', ['--dummy', 'value', target_name]) command_sha = yield manof.utils.get_running_container_label( target_name, label_name, self._logger ) - run_md5, _, _ = yield self._manof_command( + run_md5, _, _ = yield self._execute_manof_command( 'run', ['--print-run-md5-only', '--dummy', 'value', target_name] ) self.assertEqual('a3ada1db9e167a8a747c8ddd4de63757', command_sha) self.assertEqual('a3ada1db9e167a8a747c8ddd4de63757', run_md5) # different dummy data yields different run md5 - run_md5, _, _ = yield self._manof_command( + run_md5, _, _ = yield self._execute_manof_command( 'run', ['--print-run-md5-only', '--dummy', 'value2', target_name] ) self.assertNotEqual(run_md5, command_sha) @@ -62,30 +62,28 @@ def test_run_verify_md5(self): # run twice to ensure md5 won't change between runs for _ in range(2): - yield self._manof_command('run', ['--dummy', 'do', target_name]) + yield self._execute_manof_command('run', ['--dummy', 'do', target_name]) command_sha = yield manof.utils.get_running_container_label( target_name, label_name, self._logger ) - self.assertEqual('4a738101122b28baae05fac7a5dc6b32', command_sha) - run_md5, _, _ = yield self._manof_command( + run_md5, _, _ = yield self._execute_manof_command( 'run', ['--print-run-md5-only', '--dummy', 'do', target_name] ) - self.assertEqual('4a738101122b28baae05fac7a5dc6b32', run_md5) + self.assertEqual(command_sha, run_md5) # run again and make ensure md5 has changed due to "--dummy" value change - yield self._manof_command('run', ['--dummy', 'else', target_name]) + yield self._execute_manof_command('run', ['--dummy', 'else', target_name]) command_sha = yield manof.utils.get_running_container_label( target_name, label_name, self._logger ) - run_md5, _, _ = yield self._manof_command( + run_md5, _, _ = yield self._execute_manof_command( 'run', ['--print-run-md5-only', '--dummy', 'else', target_name] ) - self.assertEqual('a3ada1db9e167a8a747c8ddd4de63757', command_sha) - self.assertEqual('a3ada1db9e167a8a747c8ddd4de63757', run_md5) + self.assertEqual(command_sha, run_md5) # different dummy data yields different run md5 - run_md5, _, _ = yield self._manof_command( + run_md5, _, _ = yield self._execute_manof_command( 'run', ['--print-run-md5-only', '--dummy', 'else2', target_name] ) self.assertNotEqual(run_md5, command_sha) From 7e9172a71bf60ed1052e5776ce2c88c6336f0768 Mon Sep 17 00:00:00 2001 From: omesser Date: Sat, 13 Jul 2024 18:30:26 +0300 Subject: [PATCH 09/10] reverting install change. will issue another PR to have CI run on matrix of python versions --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index d3f208c..93a9e10 100755 --- a/install +++ b/install @@ -53,7 +53,7 @@ def main(): # (from a local dir if it exists) # "python -m pip install" instead of "pip install" handles a pip # issue where it fails in a long-named dir - run('virtualenv --python=python3.7 venv && ' + run('virtualenv --python=python3 venv && ' 'source venv/bin/activate && ' 'python -m pip install {0} incremental && '.format(local_pip_packages) + 'python -m pip install {0} -r {1}'.format(local_pip_packages, requirements_file)) From 87a93f704955a48a4eec423347dbb1dddd654043 Mon Sep 17 00:00:00 2001 From: Liran BG Date: Sat, 13 Jul 2024 20:49:03 +0300 Subject: [PATCH 10/10] Update pyproject.toml updated authors and unblocked 3.9 from being installed using manof --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 41c90a5..c6358d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,9 @@ [project] -name = 'manof' -requires-python = ">=3.7,<3.8" +name = "manof" +requires-python = ">=3.7,<3.10" version = "0.1.2" authors = [ - {name = "Your Name", email = "you@yourdomain.com"}, + {name = "LiranBG", email = "liran_ben_gida@mckinsey.com"}, ] [tool.setuptools]