cromshell icon indicating copy to clipboard operation
cromshell copied to clipboard

FR: Cromshell support for non-interactive setup

Open mbookman opened this issue 2 years ago • 8 comments

in order to use cromshell, I need to at some point interactively run cromshell to answer a few questions. The only question that actually needs to be answered is what the Cromwell server URL is; the other prompts are simply confirmation dialogs.

It should be possible to call:

cromshell update-server [URL]

For example:

cromshell update-server localhost:8000

mbookman avatar Nov 03 '22 18:11 mbookman

Cromshell just creates a dot folder in the user's home directory and stores settings in there.

Is there a reason you can't query and update the dotfile that contains the server info?

jonn-smith avatar Nov 03 '22 18:11 jonn-smith

We can manually work around this by writing the ~/.cromshell/cromwell_server.config file. That is what we are doing today.

However cromshell should either document the file and the format and expressly support people updating it directly (it could be listed in the getting started instructions), or provide a way for setting the value through the tool non-interactively. This feature request is for doing the latter, but either way is fine.

Happy to submit a PR for either approach.

mbookman avatar Nov 03 '22 18:11 mbookman

The documentation should definitely be updated.

~~As for the feature, it turns out we already have a command to update the server that I forgot about: update-server. I think that will do what you need. You can't directly query with it I don't think, but this will let you set it programmatically.~~

I'm a dummy and misunderstood your question. Yeah - this is a good idea.

jonn-smith avatar Nov 03 '22 19:11 jonn-smith

sounds like a sub-command (e.g. print-config) could be useful and not so hard to implement, for cromshell 2.0.

@bshifaw thoughts?

SHuang-Broad avatar Nov 04 '22 01:11 SHuang-Broad

cromshell2.0 creates a config file if it doesn't find it and asks the user to update it, which can also be updated via update-server. Wouldn't be a problem to add that print-config subcommand

bshifaw avatar Nov 04 '22 12:11 bshifaw

We can place that under "community feature requests" then.

SHuang-Broad avatar Nov 04 '22 13:11 SHuang-Broad

I just want to be clear on the original request; I'm unclear how we landed on the print-config command. I'm not opposed to it, but it wasn't the original request.

The original request is to be able to set the URL for Cromshell programmatically and not interactively. Today with cromshell on the master branch, when you run the "update-server" command, the following gets executed:

  # Use the update-server sub-command to modify CROMWELL_NEEDS_SETUP here.
  if [[ "${SUB_COMMAND}" == "update-server" ]] ; then
    CROMWELL_NEEDS_SETUP=true
  fi
  
  # Check if we need to set this up.
  # Note: because of how `notify` works, we can't require the setup for the notify action.
  if ${CROMWELL_NEEDS_SETUP} && [[ "${SUB_COMMAND}" != "notify" ]] ; then
    # We need to setup this install.
    # Now let's set it up:
    which dialog &> /dev/null
    r=$?
     if [[ ${r} -eq 0 ]] ; then
      setupCromshellDialog
    else
      setupCromshell
    fi
    exit 0
  fi

I'd like to be able to call:

cromshell update-server localhost:8000

and not go through any prompts.

mbookman avatar Nov 04 '22 17:11 mbookman

@mbookman Yup - I got it. I think we need both commands / options.

jonn-smith avatar Nov 04 '22 18:11 jonn-smith