Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 43 additions & 49 deletions pkg/selinux/setroubleshoot-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,60 +219,54 @@ class DismissableError extends React.Component {
* changeSelinuxMode function to use for changing the selinux enforcing mode
* dismissError function to dismiss the error message
*/
class SELinuxStatus extends React.Component {
render() {
const errorMessage = this.props.selinuxStatusError
? <DismissableError dismissError={this.props.dismissError}>{this.props.selinuxStatusError}</DismissableError>
: null;

if (this.props.selinuxStatus.enabled === undefined) {
// we don't know the current state
return (
<div>
{errorMessage}
<h3>{_("SELinux system status is unknown.")}</h3>
</div>
);
} else if (!this.props.selinuxStatus.enabled) {
// selinux is disabled on the system, not much we can do
return (
<div>
{errorMessage}
<h3>{_("SELinux is disabled on the system.")}</h3>
</div>
);
}
const configUnknown = (this.props.selinuxStatus.configEnforcing === undefined);
let note = null;
if (configUnknown)
note = _("The configured state is unknown, it might change on the next boot.");
else if (!configUnknown && this.props.selinuxStatus.enforcing !== this.props.selinuxStatus.configEnforcing)
note = _("Setting deviates from the configured state and will revert on the next boot.");

// note = _("Setting deviates from the configured state and will revert on the next boot.");
const SELinuxStatus = ({ selinuxStatus, selinuxStatusError, changeSelinuxMode, dismissError }) => {
const errorMessage = selinuxStatusError
? <DismissableError dismissError={dismissError}>{selinuxStatusError}</DismissableError>
: null;

if (selinuxStatus.enabled === undefined) {
return (
<Stack hasGutter className="selinux-policy-ct">
<Flex spaceItems={{ default: 'spaceItemsMd' }} alignItems={{ default: 'alignItemsCenter' }}>
<Title headingLevel="h2" size={TitleSizes['3xl']}>
{_("SELinux policy")}
</Title>
<Switch isChecked={this.props.selinuxStatus.enforcing}
label={_("Enforcing")}
onChange={this.props.changeSelinuxMode} />
</Flex>
{ note !== null &&
<Content component={ContentVariants.p}>
<Icon isInline status="info"><InfoCircleIcon /></Icon>
{ "\n" }
{ note }
</Content>
}
<div>
{errorMessage}
<h3>{_("SELinux system status is unknown.")}</h3>
</div>
);
} else if (!selinuxStatus.enabled) {
return (
<div>
{errorMessage}
</Stack>
<h3>{_("SELinux is disabled on the system.")}</h3>
</div>
);
}
}
const configUnknown = (selinuxStatus.configEnforcing === undefined);
let note = null;
if (configUnknown)
note = _("The configured state is unknown, it might change on the next boot.");
else if (!configUnknown && selinuxStatus.enforcing !== selinuxStatus.configEnforcing)
note = _("Setting deviates from the configured state and will revert on the next boot.");

return (
<Stack hasGutter className="selinux-policy-ct">
<Flex spaceItems={{ default: 'spaceItemsMd' }} alignItems={{ default: 'alignItemsCenter' }}>
<Title headingLevel="h2" size={TitleSizes['3xl']}>
{_("SELinux policy")}
</Title>
<Switch isChecked={selinuxStatus.enforcing}
label={_("Enforcing")}
onChange={changeSelinuxMode} />
</Flex>
{ note !== null &&
<Content component={ContentVariants.p}>
<Icon isInline status="info"><InfoCircleIcon /></Icon>
{ "\n" }
{ note }
</Content>
}
{errorMessage}
</Stack>
);
};

/* The listing only shows if we have a connection to the dbus API
* Otherwise we have blank slate: trying to connect, error
Expand Down
24 changes: 11 additions & 13 deletions pkg/storaged/logs-panel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ import { LogsPanel } from "cockpit-components-logs-panel.jsx";

const _ = cockpit.gettext;

export class StorageLogsPanel extends React.Component {
render() {
const match = [
"_SYSTEMD_UNIT=storaged.service", "+",
"_SYSTEMD_UNIT=udisks2.service", "+",
"_SYSTEMD_UNIT=dm-event.service", "+",
"_SYSTEMD_UNIT=smartd.service", "+",
"_SYSTEMD_UNIT=multipathd.service"
];
export function StorageLogsPanel() {
const match = [
"_SYSTEMD_UNIT=storaged.service", "+",
"_SYSTEMD_UNIT=udisks2.service", "+",
"_SYSTEMD_UNIT=dm-event.service", "+",
"_SYSTEMD_UNIT=smartd.service", "+",
"_SYSTEMD_UNIT=multipathd.service"
];
const search_options = { prio: "debug", _SYSTEMD_UNIT: "storaged.service,udisks2.service,dm-event.service,smartd.service,multipathd.service" };
const url = "/system/logs/#/?prio=debug&_SYSTEMD_UNIT=storaged.service,udisks2.service,dm-event.service,smartd.service,multipathd.service";

const search_options = { prio: "debug", _SYSTEMD_UNIT: "storaged.service,udisks2.service,dm-event.service,smartd.service,multipathd.service" };
const url = "/system/logs/#/?prio=debug&_SYSTEMD_UNIT=storaged.service,udisks2.service,dm-event.service,smartd.service,multipathd.service";
return <LogsPanel title={_("Storage logs")} match={match} max={10} search_options={search_options} goto_url={url} className="contains-list" />;
}
return <LogsPanel title={_("Storage logs")} match={match} max={10} search_options={search_options} goto_url={url} className="contains-list" />;
}
Loading