Skip to content

Commit

Permalink
Command line additions to test domain config changes. JB#47762
Browse files Browse the repository at this point in the history
  • Loading branch information
abranson committed Nov 1, 2019
1 parent 3c10bbd commit 54ffebd
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions ssucli/ssucli.cpp
Expand Up @@ -84,14 +84,42 @@ void SsuCli::optBrand(QStringList opt)
void SsuCli::optDomain(QStringList opt)
{
QTextStream qout(stdout);
QTextStream qerr(stderr);

if (opt.count() == 3 && opt.at(2) == "-s") {
qout << ssu.domain();
state = Idle;
} else if (opt.count() > 2 && opt.at(2) == "-c") {
if (opt.count() == 3) { // dump all domain config
QVariantMap config = ssu.getDomainConfig(ssu.domain());
for (QVariantMap::iterator i = config.begin(); i != config.end(); i++) {
qout << i.key() << ": " << i.value().toString() << endl;
}
state = Idle;
} else if (opt.count() == 4) { // dump one domain config value
QVariantMap config = ssu.getDomainConfig(ssu.domain());
qout << config.value(opt.at(3)).toString() << endl;
state = Idle;
} else if (opt.count() == 5) { // set one domain config value
QVariantMap config = ssu.getDomainConfig(ssu.domain());
config.insert(opt.at(3), opt.at(4));
QDBusPendingReply<> reply = ssuProxy->setDomainConfig(ssu.domain(), config);
reply.waitForFinished();
if (reply.isError()) {
qerr << fallingBackToDirectUse(reply.error()) << endl;
ssu.setDomainConfig(ssu.domain(), config);
}
}
} else if (opt.count() == 3) {
qout << "Changing domain from " << ssu.domain()
<< " to " << opt.at(2) << endl;
ssu.setDomain(opt.at(2));
if (ssu.listDomains().contains(opt.at(2))) {
qout << "Changing domain from " << ssu.domain()
<< " to " << opt.at(2) << endl;
ssu.setDomain(opt.at(2));
}
else {
qout << "Domain " << opt.at(2) << " does not exist" << endl;
state = Idle;
}

state = Idle;
} else if (opt.count() == 2) {
Expand Down

0 comments on commit 54ffebd

Please sign in to comment.