Improved error reporting
This commit is contained in:
parent
79bc0a92d9
commit
fceb4c4966
23
README.md
23
README.md
@ -5,29 +5,16 @@ HotFix; Quickly patch and fix system
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
$ hotfix pastebin:1234abcd
|
$ hotfix apply pastebin:1234abcd
|
||||||
Downloading hotfix...
|
$ hotfix apply gist:user/hash
|
||||||
Checking signature...
|
$ hotfix apply http://some.site/url.to.fix
|
||||||
Good signature from <bob@domain.com>
|
|
||||||
|
|
||||||
Info:
|
|
||||||
This hotfix will install this driver for you
|
|
||||||
|
|
||||||
Do you want to proceed?
|
|
||||||
Yes, No or Inspect [noi]: y
|
|
||||||
|
|
||||||
|
|
||||||
### Applying local patches
|
### Applying local patches
|
||||||
|
|
||||||
$ hotfix apply --unsigned test.hotfix
|
$ hotfix apply --insecure test.hotfix
|
||||||
Skipping signature check of test.hotfix
|
|
||||||
|
|
||||||
Info:
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
### Signing
|
### Signing
|
||||||
|
|
||||||
$ hotfix sign -o test-signed.hotfix test.hotfix
|
$ hotfix sign test.hotfix
|
||||||
...
|
|
||||||
|
|
||||||
|
@ -40,6 +40,10 @@ class ApplyCommand extends Command
|
|||||||
$output->writeln("<error>Error: ".$e->getMessage()."</error>");
|
$output->writeln("<error>Error: ".$e->getMessage()."</error>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!$hotfix) {
|
||||||
|
$output->writeln("<error>Could not load hotfix</error>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$output->writeln("");
|
$output->writeln("");
|
||||||
if (($signer = $hotfix->getSignedBy())) {
|
if (($signer = $hotfix->getSignedBy())) {
|
||||||
|
@ -21,7 +21,9 @@ class Hotfix
|
|||||||
|
|
||||||
protected function load($hotfix)
|
protected function load($hotfix)
|
||||||
{
|
{
|
||||||
// echo $hotfix."\n\n";
|
if (strpos($hotfix, "\n---\n")===false) {
|
||||||
|
throw new \Exception("Hotfix is missing a proper header, is line endings wrong?");
|
||||||
|
}
|
||||||
list ($header, $body) = explode("\n---\n", $hotfix, 2);
|
list ($header, $body) = explode("\n---\n", $hotfix, 2);
|
||||||
$header = Yaml::parse($header);
|
$header = Yaml::parse($header);
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class Loader
|
|||||||
}
|
}
|
||||||
return new Hotfix($body, $signer);
|
return new Hotfix($body, $signer);
|
||||||
}
|
}
|
||||||
fprintf(STDERR, "Error: Couldn't load '%s'", $fix);
|
fprintf(STDERR, "Error: Couldn't load '%s'\n", $fix);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function verifySignature($body, $signature)
|
protected function verifySignature($body, $signature)
|
||||||
|
@ -6,6 +6,10 @@ class HttpLoader implements LoaderInterface
|
|||||||
{
|
{
|
||||||
public function load($fix)
|
public function load($fix)
|
||||||
{
|
{
|
||||||
|
if (preg_match("/^http[s]?:/", $fix)) {
|
||||||
|
$body = file_get_contents($fix);
|
||||||
|
return $body;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user