Remove unneeded tlog UID code

The tlog UID was being set explicitly to ensure journalctl matches
used during tests would find pre-recorded journals. This is no longer
needed as we removed the TLOG_UID filter from the journalctl match
string.
This commit is contained in:
Justin Stephenson 2022-06-09 09:55:37 -04:00
parent 6f5ec24e16
commit 39a359bffb
4 changed files with 5 additions and 11 deletions

View file

@ -25,7 +25,6 @@ blocks:
commands: commands:
- export TEST_OS=fedora-35 - export TEST_OS=fedora-35
- bots/image-customize -v -i cockpit-ws -i cockpit-packagekit -i `pwd`/cockpit-session-recording*.noarch.rpm -s `pwd`/test/vm.install $TEST_OS - bots/image-customize -v -i cockpit-ws -i cockpit-packagekit -i `pwd`/cockpit-session-recording*.noarch.rpm -s `pwd`/test/vm.install $TEST_OS
- bots/image-customize -v -r "usermod -u 981 tlog || true" $TEST_OS
- bots/image-customize -v -u ./test/files/1.journal:/var/log/journal/1.journal $TEST_OS - bots/image-customize -v -u ./test/files/1.journal:/var/log/journal/1.journal $TEST_OS
- bots/image-customize -v -u ./test/files/binary-rec.journal:/var/log/journal/binary-rec.journal $TEST_OS - bots/image-customize -v -u ./test/files/binary-rec.journal:/var/log/journal/binary-rec.journal $TEST_OS
- test/check-application -v - test/check-application -v
@ -33,7 +32,6 @@ blocks:
commands: commands:
- export TEST_OS=centos-8-stream - export TEST_OS=centos-8-stream
- bots/image-customize -v -i cockpit-ws -i cockpit-packagekit -i `pwd`/cockpit-session-recording*.noarch.rpm -s `pwd`/test/vm.install $TEST_OS - bots/image-customize -v -i cockpit-ws -i cockpit-packagekit -i `pwd`/cockpit-session-recording*.noarch.rpm -s `pwd`/test/vm.install $TEST_OS
- bots/image-customize -v -r "usermod -u 981 tlog || true" $TEST_OS
- bots/image-customize -v -u ./test/files/1.journal:/var/log/journal/1.journal $TEST_OS - bots/image-customize -v -u ./test/files/1.journal:/var/log/journal/1.journal $TEST_OS
- bots/image-customize -v -u ./test/files/binary-rec.journal:/var/log/journal/binary-rec.journal $TEST_OS - bots/image-customize -v -u ./test/files/binary-rec.journal:/var/log/journal/binary-rec.journal $TEST_OS
- test/check-application -v - test/check-application -v

View file

@ -132,7 +132,6 @@ $(RPMFILE): $(TARFILE) cockpit-$(PACKAGE_NAME).spec
$(VM_IMAGE): $(RPMFILE) bots $(VM_IMAGE): $(RPMFILE) bots
rm -f $(VM_IMAGE) $(VM_IMAGE).qcow2 rm -f $(VM_IMAGE) $(VM_IMAGE).qcow2
bots/image-customize -v -i cockpit-ws -i cockpit-packagekit -i `pwd`/$(RPMFILE) -s $(CURDIR)/test/vm.install $(TEST_OS) bots/image-customize -v -i cockpit-ws -i cockpit-packagekit -i `pwd`/$(RPMFILE) -s $(CURDIR)/test/vm.install $(TEST_OS)
bots/image-customize -v -r "usermod -u 981 tlog || true" $(TEST_OS)
bots/image-customize -v -u ./test/files/1.journal:/var/log/journal/1.journal $(TEST_OS) bots/image-customize -v -u ./test/files/1.journal:/var/log/journal/1.journal $(TEST_OS)
bots/image-customize -v -u ./test/files/binary-rec.journal:/var/log/journal/binary-rec.journal $(TEST_OS) bots/image-customize -v -u ./test/files/binary-rec.journal:/var/log/journal/binary-rec.journal $(TEST_OS)

View file

@ -561,8 +561,6 @@ export default class View extends React.Component {
this.journalctlRecordingID = null; this.journalctlRecordingID = null;
/* Recording ID -> data map */ /* Recording ID -> data map */
this.recordingMap = {}; this.recordingMap = {};
/* tlog UID in system set in ComponentDidMount */
this.uid = null;
const path = cockpit.location.path[0]; const path = cockpit.location.path[0];
this.state = { this.state = {
/* List of recordings in start order */ /* List of recordings in start order */
@ -576,7 +574,7 @@ export default class View extends React.Component {
hostname: cockpit.location.options.hostname || "", hostname: cockpit.location.options.hostname || "",
search: cockpit.location.options.search || "", search: cockpit.location.options.search || "",
/* filter values end */ /* filter values end */
error_tlog_uid: false, error_tlog_user: false,
diff_hosts: false, diff_hosts: false,
/* if config is open */ /* if config is open */
config: path === "config", config: path === "config",
@ -794,13 +792,12 @@ export default class View extends React.Component {
const proc = cockpit.spawn(["getent", "passwd", "tlog"]); const proc = cockpit.spawn(["getent", "passwd", "tlog"]);
proc.stream((data) => { proc.stream((data) => {
this.uid = data.split(":", 3)[2];
this.journalctlStart(); this.journalctlStart();
proc.close(); proc.close();
}); });
proc.fail(() => { proc.fail(() => {
this.setState({ error_tlog_uid: true }); this.setState({ error_tlog_user: true });
}); });
cockpit.addEventListener("locationchanged", cockpit.addEventListener("locationchanged",
@ -838,7 +835,7 @@ export default class View extends React.Component {
render() { render() {
if (this.state.config === true) { if (this.state.config === true) {
return <Config.Config />; return <Config.Config />;
} else if (this.state.error_tlog_uid === true) { } else if (this.state.error_tlog_user === true) {
return ( return (
<Bullseye> <Bullseye>
<EmptyState variant={EmptyStateVariant.small}> <EmptyState variant={EmptyStateVariant.small}>
@ -849,7 +846,7 @@ export default class View extends React.Component {
{_("Error")} {_("Error")}
</Title> </Title>
<EmptyStateBody> <EmptyStateBody>
{_("Unable to retrieve tlog UID from system.")} {_("Unable to retrieve tlog user from system.")}
</EmptyStateBody> </EmptyStateBody>
</EmptyState> </EmptyState>
</Bullseye> </Bullseye>

View file

@ -15,7 +15,7 @@ sys.path.append(os.path.join(TEST_DIR, "common"))
sys.path.append(os.path.join(os.path.dirname(TEST_DIR), "bots/machine")) sys.path.append(os.path.join(os.path.dirname(TEST_DIR), "bots/machine"))
from testlib import * from testlib import *
# Test with pre-recorded journal with tlog UID 981 # Test with pre-recorded journal files
class TestApplication(MachineCase): class TestApplication(MachineCase):
def _login(self, loc="/session-recording", wait="#app"): def _login(self, loc="/session-recording", wait="#app"):
self.login_and_go(loc) self.login_and_go(loc)