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

[ssucli] Improve D-Bus warning (Fixes JB#30284) #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
20 changes: 12 additions & 8 deletions ssucli/ssucli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

#include "ssucli.h"


#define DBUS_LIBSSU_FALLBACK_WARNING "WARNING: D-Bus unavailable; falling back to libssu"


SsuCli::SsuCli(): QObject(){
connect(this,SIGNAL(done()),
QCoreApplication::instance(),SLOT(quit()), Qt::DirectConnection);
Expand Down Expand Up @@ -93,7 +97,7 @@ void SsuCli::optFlavour(QStringList opt){
QDBusPendingReply<> reply = ssuProxy->setFlavour(opt.at(2));
reply.waitForFinished();
if (reply.isError()){
qerr << "DBus call failed, falling back to libssu" << endl;
qerr << DBUS_LIBSSU_FALLBACK_WARNING << endl;
ssu.setFlavour(opt.at(2));

SsuRepoManager repoManager;
Expand Down Expand Up @@ -147,7 +151,7 @@ void SsuCli::optMode(QStringList opt){
QDBusPendingReply<> reply = ssuProxy->setDeviceMode(opt.at(2).toInt());
reply.waitForFinished();
if (reply.isError()){
qerr << "DBus call failed, falling back to libssu" << endl;
qerr << DBUS_LIBSSU_FALLBACK_WARNING << endl;
ssu.setDeviceMode(Ssu::DeviceModeFlags(opt.at(2).toInt()));

SsuRepoManager repoManager;
Expand Down Expand Up @@ -182,7 +186,7 @@ void SsuCli::optModifyRepo(enum Actions action, QStringList opt){
QDBusPendingReply<> reply = ssuProxy->modifyRepo(action, opt.at(2));
reply.waitForFinished();
if (reply.isError()){
qerr << "DBus call failed, falling back to libssu" << endl;
qerr << DBUS_LIBSSU_FALLBACK_WARNING << endl;

switch(action){
case Add:
Expand Down Expand Up @@ -224,7 +228,7 @@ void SsuCli::optModifyRepo(enum Actions action, QStringList opt){
QDBusPendingReply<> reply = ssuProxy->addRepo(repo, url);
reply.waitForFinished();
if (reply.isError()){
qerr << "DBus call failed, falling back to libssu" << endl;
qerr << DBUS_LIBSSU_FALLBACK_WARNING << endl;
repoManager.add(repo, url);
repoManager.update();
uidWarning();
Expand Down Expand Up @@ -266,7 +270,7 @@ void SsuCli::optRegister(QStringList opt){
QDBusPendingReply<> reply = ssuProxy->registerDevice(username, password);
reply.waitForFinished();
if (reply.isError()){
qerr << "DBus call failed, falling back to libssu" << endl;
qerr << DBUS_LIBSSU_FALLBACK_WARNING << endl;
qerr << reply.error().message() << endl;
ssu.sendRegistration(username, password);
}
Expand All @@ -290,7 +294,7 @@ void SsuCli::optRelease(QStringList opt){
QDBusPendingReply<> reply = ssuProxy->setRelease(opt.at(2), false);
reply.waitForFinished();
if (reply.isError()){
qerr << "DBus call failed, falling back to libssu" << endl;
qerr << DBUS_LIBSSU_FALLBACK_WARNING << endl;
ssu.setRelease(opt.at(2));

SsuRepoManager repoManager;
Expand All @@ -311,7 +315,7 @@ void SsuCli::optRelease(QStringList opt){
QDBusPendingReply<> reply = ssuProxy->setRelease(opt.at(3), true);
reply.waitForFinished();
if (reply.isError()){
qerr << "DBus call failed, falling back to libssu" << endl;
qerr << DBUS_LIBSSU_FALLBACK_WARNING << endl;
ssu.setRelease(opt.at(3), true);

SsuRepoManager repoManager;
Expand Down Expand Up @@ -572,7 +576,7 @@ void SsuCli::optUpdateRepos(QStringList opt){
QDBusPendingReply<> reply = ssuProxy->updateRepos();
reply.waitForFinished();
if (reply.isError()){
qerr << "DBus call failed, falling back to libssu" << endl;
qerr << DBUS_LIBSSU_FALLBACK_WARNING << endl;
SsuRepoManager repoManager;
repoManager.update();
uidWarning();
Expand Down