Ease restrictions on installing into non-empty site directories.

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

chipx86
Review Board
release-5.0.x
reviewboard

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
Ease restrictions on installing into non-empty site directories.
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)
     
     

    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
-
Ease restrictions on installing into non-empty site directories.
+
Ease restrictions on installing into non-empty site directories.

Diff:

Revision 2 (+42 -6)

Show changes

Checks run (2 succeeded)

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