We should not try to access the data, or decode it as JSON if the
request failed, because in that case the data will not be JSON and
we will get errors from the decoder.
Change-Id: Ibe663992a0487284d79e100b36392534fcbe88db
Just setup the object at construction time instead of changing it after
the fact, as we know off-hand what state it should be in. Use the new
constructor call form.
Change-Id: I5f7655eb083137b2af522038373cb7562fd7d14b
Make main() return a normal value, and let the call site act on it,
which in most cases implies doing an exit. This unifies the behavior
and gets rid of dead-code.
Change-Id: Id83284a95423b0d0e866d99f83bf546989054d76
There is no call that will pass such text as an argument, we only ever
pass the stringized list of missing parameters.
Change-Id: I1a9e2b05c59854c227685d53d9476c36086e38a9
The GetOptions() function will pass «$opt_name, $opt_value» to the
function refs in the options spec, which means that the usage()
function will consider that a missing parameters message and print
"help" as being a missing required parameter.
Use an anonymous function to wrap the usage() call and avoid the
unexpected arguments.
Change-Id: I5c10b241da23ccb7aa25a13dd5ebc1b4188b7370
We should only be printing relevant sections, not the entire man page,
which is rather verbose, and provides information not appropriate for a
--help output.
We use verbose level 1, for the commands that just have SYNOPSIS and
OPTIONS sections, and leave verbose level 99, but specify the relevant
sections which are 'SYNOPSIS|REQUIRED ARGUMENTS|OPTIONS'.
Change-Id: I59d1999599d553c396e60e183592c00e93d1a1db
We now initialize the user agent on construction, not on every request,
so the verbose mode needs to be setup there too. And it needs to support
both setting it up and tearing it down.
Change-Id: Ifa176522302db118f1702ee3b1c7ccd6b7cfabad
Fixes: commit 155873d532
We need to track whether we are within the current iterator by using an
additional variable.
Ideally we'd use a proper iterator object that is independent from the
object state, but this should do for now and fixes the regression.
Change-Id: Icc8d06f55277f49ef67fbd023fd53daa22962bce
Fixes: commit 155873d532
When moving to per-object options, we switched to set the page rows
directly from the constructor, and switched from the _rows to
_opts.page_rows.
Change-Id: Ia663dbba4a330813d67f6bbdbb50ad37419ad5d5
Fixes: commit 97c0fb6412
We should not be outputting the usage() text when we get a run-time
error, as these are unrelated and depend on the state of the server,
not on how it was called.
Change-Id: I996d52cf2e4f4a834a281f8d85ea7571f61cf2e4
The former will properly parse query strings separated by «?», the
latter will escape the «?» which will break the query arguments.
Change-Id: I29f4916a54f3d49bd5d8b7a2d0a998d57977e1dd
Update copyright years and change license to match the one declared in
debian/copyright, and the other perl programs in the repo.
Change-Id: I8d2cb1d38f267bea8c4f399ce4b921a260e2e862
We should not consider a missing configuration file a fatal problem,
now that we have defaults for almost every configuration setting,
and can override them at constructor time.
Change-Id: I371498e9d75e81c4c759012ec38b44d050bdea8f
We might want to use different values in the constructor, instead
of the ones coming from the configuration file or the global defauls.
Change-Id: Ifc9e3d762cf46a036bffb8073cd3c41a42589510
When we are just using the defaults and there's been no authentication
configured, we should just not use any authentication.
This makes it possible to use the code with no config file.
Change-Id: I9b23cd5ac806f6a56456d70175f9bdfcb436b62c
We should set sane defaults for almost all values. This will make it
possible to execute even when the configuration file is not present.
Change-Id: If85a72ad2b1470bdc9791e59810b4ba483becb9c
Some of these options can be changed via some methods, but these are
module globals that will affect any object created. This will also
make it possible to override specific options in the constructor w/o
affecting other objects.
Change-Id: I542b0bb6a45d0888878736c2d5fc58a0f7a7e653
We should not be running code that loads a configuration file in
a BEGIN block, as that will execute just by loading the module.
This makes using this module conditionally in other programs or testing
that code more difficult, as we would need to mock either this module
or the configuration file.
Just load the configuration file once in the constructor and cache
its contents, to avoid the overhead.
Change-Id: I86986dc81eaa32833b738ffa6df2a5de30159482
Instead of recomputing these every time we do a request, cache them
and reuse to avoid the object construction time, when we do not need
different constructor arguments over time.
Change-Id: I4d6039fc312a4e453a9eac6d59fe28f877613a6b
The to/from_json() are deprecated functions, which we should not be
using. Switch to the new ones, which also means we can stop encoding
the strings to and from UTF-8 explicitly.
Change-Id: Ie29371d532a51a3a62d54c35d22a6d488fe1b513
* ngcp-fraud-daily-lock and ngcp-fraud-auto-lock are
not supported anymore and replacted by ngcp-fraud-notifier
that does not lock contracts/subscribers but sends email
notifications and updates cdr_period_costs "notify_status"
and "nofified_at"
Change-Id: Icacbddc68fb25408a388f52427aab993c085dba3