#778 add history to edit_host
Merged by mikem. Opened by tkopecek.
tkopecek/koji issue638  into  master

Download 778.patch

Hosts now have history.

host table was split to host (containing ephemereal and non-editable
data (load, activity, name, user_id)) and host_config containing
data changeable by admins (archs, capacity, ...). This table is
versioned and searchable via queryHistory.

Fixes: https://pagure.io/koji/issue/638

1 new commit added

  • update schema.sql for host_config

2 new commits added

  • add index
  • JOIN fixes for host_config

Seems like we should also version host_channels.

wrong version in comment

There are a lot of changes here, we should make sure we have unit test coverage.

If we add history to host_channels, it would affect remove_channel. In such case we will never delete most of channels as it would still be referenced from inactive host_channels. On the other hand, we can go one more step further and version also channel table.

Would it make sense to create host_channels/channels version another PR?

/added some tests meanwhile/

2 new commits added

  • host history tests
  • update version in comment

If we add history to host_channels, it would affect remove_channel. In such case we will never delete most of channels as it would still be referenced from inactive host_channels.

I think this will be ok. We'll just need to update the docstring. Having channel history for hosts will be worth the price.

On the other hand, we can go one more step further and version also channel table.

We don't have any other versioned name lookup tables, I'm not sure I'd want to have an exception to that here.

We could follow the approach with the tag table and have a versioned channel_config table. Nothing much to put there right now, but maybe in the future.

rebased onto 491de84102ec8b4d569bcbab70cae0cbf143b346

Added versions for host_channels.

rebased onto 9ee72d884ad014f8417c422f1b4ce0f2953ec7ce

Looks good overall. Fixed a few issues and added support to query history by host and channel.

https://github.com/mikem23/koji-playground/commits/pagure/pr/778

Seems to be working :smile:

$ kdev lkoji list-history --host builder-04
2018-04-27 15:57:18,476 [DEBUG] koji: Opening new requests session
successfully connected to hub
Fri Apr 27 11:11:32 2018 host builder-04 added to channel default by mikem [still active]
Fri Apr 27 11:11:32 2018 new host: builder-04 by mikem
Fri Apr 27 11:22:17 2018 host configuration for builder-04 altered by mikem
Fri Apr 27 11:22:19 2018 host configuration for builder-04 altered by mikem
Fri Apr 27 11:22:25 2018 host configuration for builder-04 altered by mikem
    enabled: True -> False
Fri Apr 27 11:22:26 2018 host configuration for builder-04 altered by mikem
    enabled: False -> True
Fri Apr 27 11:22:27 2018 host configuration for builder-04 altered by mikem
    enabled: True -> False
Fri Apr 27 11:23:33 2018 host builder-04 added to channel image by mikem
Fri Apr 27 11:23:42 2018 host builder-04 removed from channel image by mikem
Fri Apr 27 11:23:43 2018 host builder-04 added to channel image by mikem
Fri Apr 27 11:23:45 2018 host builder-04 removed from channel image by mikem
Fri Apr 27 11:30:51 2018 host configuration for builder-04 altered by mikem
    comment: None -> hello
Fri Apr 27 11:30:55 2018 host configuration for builder-04 altered by mikem
    comment: hello -> hello world

~~err, hold, on, gotta fix that branch...~~

ok, fixed now

:thumbsup:

Commit 65d69909 fixes this pull-request

Pull-Request has been merged by mikem

Metadata