Edgewall Software

Opened 6 years ago

Closed 5 years ago

Last modified 18 months ago

#12965 closed enhancement (fixed)

Remove default components and milestones in `trac-admin initenv` — at Version 7

Reported by: anonymous Owned by: Ryan J Ollos
Priority: normal Milestone: 1.5.1
Component: admin/console Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Added option --no-default-data to trac-admin initenv, for creating an empty environment without any reports, permission groups or sample data (components, milestones, enums).

API Changes:

DatabaseManager.init_db sets the database_version and initial_database_version in the system table.

Internal Changes:

Description

When initializing a new environment it will be populated with placeholder components and milestones (ie "component#" and "milestone#").

However I think it's rather unlikely that these actual components and milestones will be useful in an actual project. This means that the next step is likely to manually remove these components and milestones and populate the environment with relevant components and milestones.

I suggest that trac-admin initenv instead create an environment without any components or milestones predefined or if required prompt the user for the actual names of the components and milestones.

Change History (7)

comment:1 by Ryan J Ollos, 6 years ago

Milestone: next-major-releases

We can consider adding a --no-default-data option.

comment:2 by Ryan J Ollos, 6 years ago

r16341 moved the DatabaseManager.insert_into_tables call to the DatabaseManager class via implementation of IEnvironmentSetupParticipant. The motivation was to reduce coupling between the modules.

The change would either need to be reverted, or we would need a way to pass a parameter to environment_created. We could add an argument to IEnvironmentSetupParticipant.environment_created for passing parameters.

PoC changes in [d9b04db04/rjollos.git]. Note that the --no-default-data argument results in skipping insertion of all default data: components, milestones, enums, permissions and reports. We could divide this into "sample data" and "default data" (i.e. default configuration data). Milestones, components and versions are clearly sample data. However, whether enums are sample data is a bit more subjective, and I think that permissions and reports are clearly default data.

If anything is done related to this ticket, I think the aim should be to give more control over how the environment is populated with data, not to extend initenv so that resources like milestones can be added while interactively running initenv. Note that everything request in comment:description can be scripted using trac-admin commands. For example, use the TracAdmin milestone remove / milestone add commands, or milestone rename.

comment:3 by Ryan J Ollos, 5 years ago

Milestone: next-major-releases1.5.1
Owner: set to Ryan J Ollos
Release Notes: modified (diff)
Status: newassigned

I've experimented a bit, and now have the following proposed changes:

  • --no-default-data will yield an empty environment: no reports, milestones, components, permission groups, etc. This gives the user two scripting options: Start with no data and add (e.g. trac-admin milestone add ..), or start with sample data and delete what's unwanted.
  • Add method DatabaseManager.insert_default_data, which is called from Environment.create.
  • The database version entries in the system tables are always inserted when the database is initialized, set by DatabaseManager.init_db (this is a minor API change).

log:rjollos.git:t12965_initenv_no_default_data.2

Thoughts?

If it looks okay, I'll tidy up the docstrings and add test coverage.

comment:4 by Ryan J Ollos, 5 years ago

I will add test coverage and proceed to push the changes in absence of any feedback.

Rebased in log:rjollos.git:t12965_initenv_no_default_data.3 —squashed→ [29a8d17a0/rjollos.git]

comment:5 by Jun Omae, 5 years ago

The changes look good to me.

comment:6 by Ryan J Ollos, 5 years ago

Thanks for review.

Added tests: [16684974a/rjollos.git].

comment:7 by Ryan J Ollos, 5 years ago

API Changes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to trunk in r17162.

Note: See TracTickets for help on using tickets.