Ease restrictions on installing into non-empty site directories.

Review Request #12997 — Created April 30, 2023 and updated

Information

Review Board
release-5.0.x

Reviewers

rb-site install will now permit installing into a site directory that
contains only a venv folder. This is to enable deployments where a
virtual environment is first set up in the destination sitedir, and then
the installed rb-site is used to populate the sitedir.

There's also a --allow-non-empty-sitedir option for advanced use,
which bypasses the empty sitedir check.

Tested installing into a populated sitedir. It gave me the expected error.

Tested installing into a new location. Installation was allowed.

Tested installing into a directory containing just a venv directory.
Installation was allowed.

Tested installing into an empty directory. Installation was allowed.

Tested installing into a populated sitedir and using
--allow-non-empty-sitedir. Installation was allowed.

Summary ID
Ease restrictions on installing into non-empty site directories.
`rb-site install` will now permit installing into a site directory that contains only a `venv` folder. This is to enable deployments where a virtual environment is first set up in the destination sitedir, and then the installed `rb-site` is used to populate the sitedir. There's also a `--allow-non-empty-sitedir` option for advanced use, which bypasses the empty sitedir check.
250004ff338b8ff4146c06cba12e4ce04dfa4726
Description From Last Updated

I think it's somewhat confusing to have the conditional be in the assignment to site_contents. How about we do: site_contents …

daviddavid
chipx86
david
  1. 
      
  2. reviewboard/cmdline/rbsite.py (Diff revision 1)
     
     
    Show all issues

    I think it's somewhat confusing to have the conditional be in the assignment to site_contents. How about we do:

    site_contents = os.listdir(install_dir)
    
    if (site_contents and
        site contents != ['venv'] and
        not options.allow_non_empty_sitedir):
        ...
    
    1. I was just aiming to avoid an unncessary os.listdir(), but that's probably not worth optimizing for.

  3. 
      
chipx86
Review request changed
Change Summary:

Simplified the logic for determining whether a directory can be installed into.

Commits:
Summary ID
Ease restrictions on installing into non-empty site directories.
`rb-site install` will now permit installing into a site directory that contains only a `venv` folder. This is to enable deployments where a virtual environment is first set up in the destination sitedir, and then the installed `rb-site` is used to populate the sitedir. There's also a `--allow-non-empty-sitedir` option for advanced use, which bypasses the empty sitedir check.
3fc1ba7366fdcc779a7180267883d9c1341f8d83
Ease restrictions on installing into non-empty site directories.
`rb-site install` will now permit installing into a site directory that contains only a `venv` folder. This is to enable deployments where a virtual environment is first set up in the destination sitedir, and then the installed `rb-site` is used to populate the sitedir. There's also a `--allow-non-empty-sitedir` option for advanced use, which bypasses the empty sitedir check.
250004ff338b8ff4146c06cba12e4ce04dfa4726

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
david
  1. Ship It!
  2.