Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add instructions to enable kdump on microos systems #21182

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
24 changes: 19 additions & 5 deletions pkg/kdump/kdump-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -414,20 +414,34 @@ export class KdumpPage extends React.Component {
# A reboot will be required if crashkernel was not set before
kdumpctl reset-crashkernel`;
}
const shell = `
Lunarequest marked this conversation as resolved.
Show resolved Hide resolved
let shell;
if (this.state.os_release.NAME?.includes('MicroOS')) {
enableCrashKernel = `
martinpitt marked this conversation as resolved.
Show resolved Hide resolved
# A reboot will be required if crashkernel was not set before
transactional-update setup-kdump`;
shell = `
martinpitt marked this conversation as resolved.
Show resolved Hide resolved
cat > /etc/kdump.conf << EOF
${kdumpconf}
martinpitt marked this conversation as resolved.
Show resolved Hide resolved
EOF
${enableCrashKernel}
martinpitt marked this conversation as resolved.
Show resolved Hide resolved
`;
} else {
shell = `
cat > /etc/kdump.conf << EOF
${kdumpconf}
EOF
systemctl enable --now kdump.service
${enableCrashKernel}
`;
}

Dialogs.show(
<ModificationsExportDialog
ansible={exportAnsibleTask(this.props.kdumpStatus.config, this.state.os_release)}
shell={shell}
show
onClose={Dialogs.close}
ansible={ this.state.os_release.NAME?.includes('MicroOS') ? null : exportAnsibleTask(this.props.kdumpStatus.config, this.state.os_release)}
shell={shell}
show
onClose={Dialogs.close}

/>);
}

Expand Down
59 changes: 37 additions & 22 deletions pkg/lib/cockpit-components-modifications.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const _ = cockpit.gettext;
*
*/
export const ModificationsExportDialog = ({ show, onClose, shell, ansible }) => {
const [active_tab, setActiveTab] = React.useState("ansible");
const [active_tab, setActiveTab] = React.useState(ansible ? "ansible" : "shell");
const [copied, setCopied] = React.useState(false);
const [timeoutId, setTimeoutId] = React.useState(null);

Expand Down Expand Up @@ -77,37 +77,52 @@ export const ModificationsExportDialog = ({ show, onClose, shell, ansible }) =>
</Button>
</>
);

return (
<Modal isOpen={show} className="automation-script-modal"
if (ansible === null) {
return (
<Modal isOpen={show} className="automation-script-modal"
position="top" variant="medium"
onClose={onClose}
footer={footer}
title={_("Automation script") }>
<Tabs activeKey={active_tab} onSelect={handleSelect}>
<Tab eventKey="shell" title={_("Shell script")}>
<TextArea resizeOrientation='vertical' readOnlyVariant="default" defaultValue={shell.trim()} />
</Tab>
</Tabs>
</Modal>
Comment on lines +87 to +92
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 6 added lines are not executed by any test.

);
} else {
return (
<Modal isOpen={show} className="automation-script-modal"
position="top" variant="medium"
onClose={onClose}
footer={footer}
title={_("Automation script") }>
<Tabs activeKey={active_tab} onSelect={handleSelect}>
<Tab eventKey="ansible" title={_("Ansible")}>
<TextArea resizeOrientation='vertical' readOnlyVariant="default" defaultValue={ansible.trim()} />
<div className="ansible-docs-link">
<OutlinedQuestionCircleIcon />
{ _("Create new task file with this content.") }
<Button variant="link" component="a" href="https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html"
<Tabs activeKey={active_tab} onSelect={handleSelect}>
<Tab eventKey="ansible" title={_("Ansible")}>
<TextArea resizeOrientation='vertical' readOnlyVariant="default" defaultValue={ansible.trim()} />
<div className="ansible-docs-link">
<OutlinedQuestionCircleIcon />
{ _("Create new task file with this content.") }
<Button variant="link" component="a" href="https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html"
target="_blank" rel="noopener noreferrer"
icon={<ExternalLinkAltIcon />}>
{ _("Ansible roles documentation") }
</Button>
</div>
</Tab>
<Tab eventKey="shell" title={_("Shell script")}>
<TextArea resizeOrientation='vertical' readOnlyVariant="default" defaultValue={shell.trim()} />
</Tab>
</Tabs>
</Modal>
);
{ _("Ansible roles documentation") }
</Button>
</div>
</Tab>
<Tab eventKey="shell" title={_("Shell script")}>
<TextArea resizeOrientation='vertical' readOnlyVariant="default" defaultValue={shell.trim()} />
</Tab>
</Tabs>
</Modal>
);
}
};

ModificationsExportDialog.propTypes = {
shell: PropTypes.string.isRequired,
ansible: PropTypes.string.isRequired,
ansible: PropTypes.string,
show: PropTypes.bool.isRequired,
onClose: PropTypes.func.isRequired,
};
Expand Down