Bug 1267956

Summary: RFE: use latest commit for ostree show if none specified
Product: [Fedora] Fedora Reporter: Alexander Todorov <atodorov>
Component: ostreeAssignee: Colin Walters <walters>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhideCC: atodorov, gscrivan, jkrieger, mbarnes, walters
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-27 14:42:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alexander Todorov 2015-10-01 13:02:51 UTC
Please make ostree show use the latest commit if no parameter was specified. 


I have a workflow like this:


# atomic host status
  TIMESTAMP (UTC)         VERSION     ID             OSNAME               REFSPEC                                                        
* 2015-07-31 13:17:47     7.1.4       23e5e89ba5     rhel-atomic-host     rhel-atomic-host-ostree:rhel-atomic-host/7/x86_64/standard     
  2015-07-24 15:03:31     7.1.3.1     34b9bb94a7     rhel-atomic-host     rhel-atomic-host-ostree:rhel-atomic-host/7/x86_64/standard 

# ostree show 23e5e89ba5
... skip ...


If we can make ostree show default to the latest it will be easier for automation tools b/c I won't have to parse the output of the previous command. This will also be consistent with 'git show'.

Comment 1 Giuseppe Scrivano 2015-12-17 11:36:46 UTC
You can specify the branch name:

# ostree show rhel-atomic-host/7/x86_64/standard

Would that work for you?

Comment 2 Matthew Barnes 2015-12-17 20:38:03 UTC
Defaulting to the latest commit on a booted ostree deployment of course can only work if you're actually booted into an ostree deployment.  This won't work if you're on, say, a plain Fedora machine staging commits on a local ostree repo.

And it violates the "ostree" vs "ostree admin" command partitioning.

That said, if we considered this a restricted special case -- failing as it does now when not applicable -- then it could be a nice usability win.

And similar defaults could apply to other non-admin commands like "ostree log", which I've typed many times myself forgetting the REF argument.

It's a design decision for Colin, though.

Comment 3 Colin Walters 2015-12-17 20:43:50 UTC
(In reply to Matthew Barnes from comment #2)

> And it violates the "ostree" vs "ostree admin" command partitioning.

This is indeed something that honestly is *very* confusing for administrators, and I think in retrospect I chose wrong.  The default should have been `ostree fs` for the filesystem stuff, then `ostree` = `ostree admin`.  Oh well.

(This is of course leaving aside the whole rpm-ostree/atomic extra layers)

Which speaking of, we can certainly add more verbs on either side for this.

`atomic host show-commit`

could do what you want.

Comment 4 Alexander Todorov 2015-12-18 07:48:52 UTC
(In reply to Giuseppe Scrivano from comment #1)
> You can specify the branch name:
> 
> # ostree show rhel-atomic-host/7/x86_64/standard
> 
> Would that work for you?

Yes.