bsdci / ioc

libioc command line tool for BSD jail management
Other
16 stars 1 forks source link

ioc cli parameters are very inconsistent #6

Open igalic opened 6 years ago

igalic commented 6 years ago

for reasons of backwards compatibility, we've made ioc's command line interface as inconsistent as its predecessors'.

currently we have three formats, which mostly differ where the <jail>, that is being operated on is placed, and how it's passed.

  1. via the --name option:

    ioc create --name <jail>
  2. as first (and only parameter)

    ioc start <jail>
  3. as first parameter of infinitely many:

    ioc exec <jail> cat /etc/passwd
  4. as last parameter of infinitely many:

    ioc set ip4_addr='vtnet0|172.16.0.9/12' template=no <jail>

i propose standardizing on one format. if we want to provide backwards compatibility, we should do this shims that our users can install themselves in place of the iocace_legacy (/usr/local/sbin/iocage) or iocage (/usr/local/bin/iocage) binaries.

igalic commented 6 years ago

i just realized this is a resurrection of #202. and honestly, i think it's very necessary.

gronke commented 6 years ago

if we want to provide backwards compatibility, we should do this shims that our users can install themselves in place of the iocace_legacy

Great idea, that would allow us to be more strict/consequent with the CLI command logic. For example

  1. ioc create <jail> or ioc create -b <jail> [<jail_options>]
  2. ioc set <jail> <jail_options>

We should offload the discussion to the Wiki and see where we hit issues.

igalic commented 6 years ago

i was thinking about the documentation, especially in the context of copy on the iocage website, which uses the word cage on the front-page.

if we start from the definition of a cage is a zfs backed jail, then we should be constantly talking of cage not jail within (lib)iocage.

igalic commented 5 years ago

Before we move this issue any further, I'd like to discuss

Defining a CLI Language

to do that, i'd first like to document the commands we have right now, and group them by the Object they work on:

Command Description
activate Set a zpool active for iocage usage.
clone Clone and promote jails.
console Login to a jail.
create Create a jail.
deactivate Disable a ZFS pool for libioc.
destroy Destroy specified resource
exec Run the given command inside the specified...
export Export a jail to a backup archive
fetch Fetch and update a Release to create Jails...
fstab View and manipulate a jails fstab file.
get Gets the specified property.
import Import a jail from a backup archive
list List a specified dataset type, by default...
migrate Migrate jails to the latest format.
pkg Manage packages in a jail.
promote Clone and promote jails.
provision Trigger provisioning of jails.
rename Rename a stopped jail.
restart Restarts the specified jails.
set Sets the specified property.
snapshot Take and manage resource snapshots.
start Starts the specified jails or ALL.
stop Stops the specified jails or ALL.
update Update a jail to a new release or patchlevel.

By Object

The first obvious "object" i can identify is the one that uses the commands start, stop, restart, exec and console — none of those commands work without a "live" jail.

but after that, it gets kinda hazy (for me)