codecov[bot]: # [Codecov](https://codecov.io/gh/xen0l/aws-gate/pull/60?src=pr&el=h1) Report
> Merging [#60](https://codecov.io/gh/xen0l/aws-gate/pull/60?src=pr&el=desc) into [master](https://codecov.io/gh/xen0l/aws-gate/commit/43b795dd2e770cf0b85ed22d0afe4e43bd8661e1?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/xen0l/aws-gate/pull/60/graphs/tree.svg?width=650&token=nlxNAKfBE9&height=150&src=pr)](https://codecov.io/gh/xen0l/aws-gate/pull/60?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master      #60   +/-   ##
=======================================
  Coverage   95.62%   95.62%           
=======================================
  Files          11       11           
  Lines         503      503           
=======================================
  Hits          481      481           
  Misses         22       22
```


| [Impacted Files](https://codecov.io/gh/xen0l/aws-gate/pull/60?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [aws\_gate/bootstrap.py](https://codecov.io/gh/xen0l/aws-gate/pull/60/diff?src=pr&el=tree#diff-YXdzX2dhdGUvYm9vdHN0cmFwLnB5) | `95.58% <100%> (ø)` | :arrow_up: |
| [aws\_gate/decorators.py](https://codecov.io/gh/xen0l/aws-gate/pull/60/diff?src=pr&el=tree#diff-YXdzX2dhdGUvZGVjb3JhdG9ycy5weQ==) | `100% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/xen0l/aws-gate/pull/60?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/xen0l/aws-gate/pull/60?src=pr&el=footer). Last update [43b795d...798bab3](https://codecov.io/gh/xen0l/aws-gate/pull/60?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

diff --git a/aws_gate/bootstrap.py b/aws_gate/bootstrap.py
index 9e22207..9bf769b 100644
--- a/aws_gate/bootstrap.py
+++ b/aws_gate/bootstrap.py
@@ -68,7 +68,7 @@ class MacPlugin(Plugin):
 
         if not os.path.exists(DEFAULT_GATE_BIN_PATH):
             logger.debug('Creating %s', DEFAULT_GATE_BIN_PATH)
-            os.mkdir(DEFAULT_GATE_BIN_PATH)
+            os.makedirs(DEFAULT_GATE_BIN_PATH)
 
         with open(plugin_src_path, 'rb') as f_src, open(plugin_dst_path, 'wb') as f_dst:
             logger.debug('Copying %s to %s', plugin_src_path, plugin_dst_path)
diff --git a/aws_gate/decorators.py b/aws_gate/decorators.py
index c1d26c8..b153428 100644
--- a/aws_gate/decorators.py
+++ b/aws_gate/decorators.py
@@ -24,7 +24,7 @@ def plugin_version(required_version):
     def _outer_wrapper(wrapped_function):
         @functools.wraps(wrapped_function)
         def _wrapper(*args, **kwargs):
-            version = execute(PLUGIN_INSTALL_PATH, ['--version'])
+            version = execute(PLUGIN_INSTALL_PATH, ['--version'], capture_output=True)
 
             if version and int(version.replace('.', '')) < int(required_version.replace('.', '')):
                 raise ValueError('Invalid plugin version: {}'.format(version))

`aws-gate bootstrap` is broken
I upgraded aws-gate and started to get errors. I guess is because, after #41 got pushed, it no longer accept session-manager-plugin to be provided by the host system. However, most of our users already have it installed by other ways.

```
OSError: session-manager-plugin not found
```

Trying to `aws-gate bootstrap` gives error because the needed folder is not yet created
```
$ aws-gate -v bootstrap
[Errno 2] No such file or directory: '/Users/alanjds/.aws-gate/bin'
```

After creating manually, the installation can succeed:
```
$ mkdir -p /Users/alanjds/.aws-gate/bin
$ aws-gate -v bootstrap
1.1.26.0
session-manager-plugin (version None) installed successfully!
```

After #41, aws-gate no longer accept the plugin to be provided by system.
For curiosity, why is it allowing only owned version to be used?

What about allowing usage of existing one if available, maybe with a deprecation or warning message?

diff --git a/test/unit/test_bootstrap.py b/test/unit/test_bootstrap.py
index 8ed6a33..b5b4c90 100644
--- a/test/unit/test_bootstrap.py
+++ b/test/unit/test_bootstrap.py
@@ -55,8 +55,8 @@ class TestBootstrap(unittest.TestCase):
                 patch('aws_gate.bootstrap._check_plugin_version', return_value='1.1.23.0'):
             plugin.install()
 
-            self.assertTrue(os_mock.mkdir.called)
-            self.assertEqual(os_mock.mkdir.call_args, call(DEFAULT_GATE_BIN_PATH))
+            self.assertTrue(os_mock.makedirs.called)
+            self.assertEqual(os_mock.makedirs.call_args, call(DEFAULT_GATE_BIN_PATH))
             self.assertTrue(shutil_mock.copyfileobj.called)
             self.assertTrue(os_mock.chmod.called)
 

pip install -e .
parse_log_pytest
requirements.txt
pytest
3.7
requirements/requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
-e git+https://github.com/xen0l/aws-gate.git@43b795dd2e770cf0b85ed22d0afe4e43bd8661e1#egg=aws_gate
boto3==1.9.253
botocore==1.12.253
certifi @ file:///croot/certifi_1671487769961/work/certifi
chardet==3.0.4
docutils==0.15.2
exceptiongroup==1.2.2
idna==2.8
importlib-metadata==6.7.0
iniconfig==2.0.0
jmespath==0.10.0
marshmallow==2.20.0
packaging==24.0
pluggy==1.2.0
pytest==7.4.4
python-dateutil==2.9.0.post0
PyYAML==5.1.2
requests==2.22.0
s3transfer==0.2.1
six==1.17.0
tomli==2.0.1
typing_extensions==4.7.1
urllib3==1.25.11
zipp==3.15.0

name: aws-gate
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - boto3==1.9.253
      - botocore==1.12.253
      - chardet==3.0.4
      - docutils==0.15.2
      - exceptiongroup==1.2.2
      - idna==2.8
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - jmespath==0.10.0
      - marshmallow==2.20.0
      - packaging==24.0
      - pluggy==1.2.0
      - pytest==7.4.4
      - python-dateutil==2.9.0.post0
      - pyyaml==5.1.2
      - requests==2.22.0
      - s3transfer==0.2.1
      - six==1.17.0
      - tomli==2.0.1
      - typing-extensions==4.7.1
      - urllib3==1.25.11
      - zipp==3.15.0
prefix: /opt/conda/envs/aws-gate

test/unit/test_bootstrap.py::TestBootstrap::test_mac_plugin_install_non_existent_bin_dir
test/unit/test_bootstrap.py::TestBootstrap::test_bootstrap_darwin test/unit/test_bootstrap.py::TestBootstrap::test_bootstrap_unsupported_platform test/unit/test_bootstrap.py::TestBootstrap::test_mac_plugin_extract_invalid_zip test/unit/test_bootstrap.py::TestBootstrap::test_mac_plugin_extract_valid test/unit/test_bootstrap.py::TestBootstrap::test_plugin_download test/unit/test_bootstrap.py::TestBootstrap::test_plugin_extract_raises_notimplementederror test/unit/test_bootstrap.py::TestBootstrap::test_plugin_install_raises_notimplementederror test/unit/test_bootstrap.py::TestBootstrap::test_plugin_is_installed
aws_gate/bootstrap.py aws_gate/decorators.py
aws_gate/bootstrap.py aws_gate/decorators.py