mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 02:45:44 -05:00
[libcalamares] Redacted -> RedactedCommand
- For logging (shell) commands where a password might become visible, use RedactedCommand. Rename it to allow for other kinds of redaction, too.
This commit is contained in:
parent
7cc84b89be
commit
7b3c4db8f0
3 changed files with 7 additions and 7 deletions
|
@ -229,7 +229,7 @@ toString( const QVariant& v )
|
|||
}
|
||||
|
||||
QDebug&
|
||||
operator<<( QDebug& s, const Redacted& l )
|
||||
operator<<( QDebug& s, const RedactedCommand& l )
|
||||
{
|
||||
// Special case logging: don't log the (encrypted) password.
|
||||
if ( l.list.contains( "usermod" ) )
|
||||
|
|
|
@ -214,9 +214,9 @@ public:
|
|||
* since the log may get posted to bug reports, or stored in
|
||||
* the target system.
|
||||
*/
|
||||
struct Redacted
|
||||
struct RedactedCommand
|
||||
{
|
||||
Redacted( const QStringList& l )
|
||||
RedactedCommand( const QStringList& l )
|
||||
: list( l )
|
||||
{
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ struct Redacted
|
|||
const QStringList& list;
|
||||
};
|
||||
|
||||
QDebug& operator<<( QDebug& s, const Redacted& l );
|
||||
QDebug& operator<<( QDebug& s, const RedactedCommand& l );
|
||||
|
||||
/**
|
||||
* @brief Formatted logging of a pointer
|
||||
|
|
|
@ -163,7 +163,7 @@ Calamares::Utils::Runner::run()
|
|||
} );
|
||||
}
|
||||
|
||||
cDebug() << Logger::SubEntry << "Running" << Logger::Redacted( m_command );
|
||||
cDebug() << Logger::SubEntry << "Running" << Logger::RedactedCommand( m_command );
|
||||
process.start();
|
||||
if ( !process.waitForStarted() )
|
||||
{
|
||||
|
@ -225,13 +225,13 @@ Calamares::Utils::Runner::run()
|
|||
{
|
||||
if ( !output.isEmpty() )
|
||||
{
|
||||
cDebug() << Logger::SubEntry << "Target cmd:" << Logger::Redacted( m_command ) << "Exit code:" << r
|
||||
cDebug() << Logger::SubEntry << "Target cmd:" << Logger::RedactedCommand( m_command ) << "Exit code:" << r
|
||||
<< "output:\n"
|
||||
<< Logger::NoQuote << output;
|
||||
}
|
||||
else
|
||||
{
|
||||
cDebug() << Logger::SubEntry << "Target cmd:" << Logger::Redacted( m_command ) << "Exit code:" << r
|
||||
cDebug() << Logger::SubEntry << "Target cmd:" << Logger::RedactedCommand( m_command ) << "Exit code:" << r
|
||||
<< "(no output)";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue