Error calling hammer.run() from w/in 'hammer csv subscriptions'

I get an error "RuntimeError (Current textdomain (nil) was not added, use
FastGettext.add_text_domain !" during a call to hammer.run() from w/in
another hammer command. Effectively 'hammer csv subscriptions' is calling
'hammer subscription upload' from w/in itself. If I add this code[1] prior
to calling hammer.run() then things work as expected (and as it had
previously).

What is the proper way to config FastGettext in hammer module?

[1]
https://github.com/thomasmckay/hammer-cli-csv/blob/fastgettext/lib/hammer_cli_csv/subscriptions.rb#L62-L68

Opened a PR that works but I'd like to understand the problem and what
changed, if anyone has any insights.

··· On Fri, Sep 2, 2016 at 1:14 PM, Tom McKay wrote:

I get an error “RuntimeError (Current textdomain (nil) was not added, use
FastGettext.add_text_domain !” during a call to hammer.run() from w/in
another hammer command. Effectively ‘hammer csv subscriptions’ is calling
‘hammer subscription upload’ from w/in itself. If I add this code[1] prior
to calling hammer.run() then things work as expected (and as it had
previously).

What is the proper way to config FastGettext in hammer module?

[1] GitHub - thomasmckay/hammer-cli-csv
blob/fastgettext/lib/hammer_cli_csv/subscriptions.rb#L62-L68

Recently there were some changes in how the translation domains are handled
in hammer with new fast_gettext. See the PR [1] for more details. There was
hammer 0.8.0 gem released last week containing the changes.
What hammer version anf fast_gettext do you use?

I checked the hammer-cli-csv PR and I'm not sure why are you adding the
domain manualy for the second time and not only with HammerCLI::I18n.add_domain
but it was not necessary for hammer-cli-foreman.

[1] https://github.com/theforeman/hammer-cli/commit/
6e28b70ff1a05344b0af7abd5a2f660d74ba6df7

··· On Fri, Sep 2, 2016 at 9:44 PM, Tom McKay wrote:

Opened a PR that works but I’d like to understand the problem and what
changed, if anyone has any insights.
https://github.com/Katello/hammer-cli-csv/pull/121

On Fri, Sep 2, 2016 at 1:14 PM, Tom McKay thomasmckay@redhat.com wrote:

I get an error “RuntimeError (Current textdomain (nil) was not added, use
FastGettext.add_text_domain !” during a call to hammer.run() from w/in
another hammer command. Effectively ‘hammer csv subscriptions’ is calling
’hammer subscription upload’ from w/in itself. If I add this code[1] prior
to calling hammer.run() then things work as expected (and as it had
previously).

What is the proper way to config FastGettext in hammer module?

[1] https://github.com/thomasmckay/hammer-cli-csv/blob/
fastgettext/lib/hammer_cli_csv/subscriptions.rb#L62-L68


You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Without the lines add_text_domain the errors happen. Could be that katello
is not initialized at the time I am calling hammer.run() for one of its
commands? I'm just guessing at things at this point.

I am on ruby-2.3.1 w/ fast_gettext-1.2.0

··· On Mon, Sep 5, 2016 at 4:13 AM, Martin Bačovský wrote:

Recently there were some changes in how the translation domains are
handled in hammer with new fast_gettext. See the PR [1] for more details.
There was hammer 0.8.0 gem released last week containing the changes.
What hammer version anf fast_gettext do you use?

I checked the hammer-cli-csv PR and I’m not sure why are you adding the
domain manualy for the second time and not only with HammerCLI::I18n.add_domain
but it was not necessary for hammer-cli-foreman.

[1] https://github.com/theforeman/hammer-cli/commit/6e28b70ff1a0
5344b0af7abd5a2f660d74ba6df7

On Fri, Sep 2, 2016 at 9:44 PM, Tom McKay thomasmckay@redhat.com wrote:

Opened a PR that works but I’d like to understand the problem and what
changed, if anyone has any insights.
https://github.com/Katello/hammer-cli-csv/pull/121

On Fri, Sep 2, 2016 at 1:14 PM, Tom McKay thomasmckay@redhat.com wrote:

I get an error “RuntimeError (Current textdomain (nil) was not added,
use FastGettext.add_text_domain !” during a call to hammer.run() from w/in
another hammer command. Effectively ‘hammer csv subscriptions’ is calling
’hammer subscription upload’ from w/in itself. If I add this code[1] prior
to calling hammer.run() then things work as expected (and as it had
previously).

What is the proper way to config FastGettext in hammer module?

[1] https://github.com/thomasmckay/hammer-cli-csv/blob/fastgette
xt/lib/hammer_cli_csv/subscriptions.rb#L62-L68


You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

This is blocking me now as it happens in lots of commands. Any suggestions
welcome. Maybe I need to create some mo files or something?

··· On Tue, Sep 6, 2016 at 10:06 AM, Tom McKay wrote:

Without the lines add_text_domain the errors happen. Could be that katello
is not initialized at the time I am calling hammer.run() for one of its
commands? I’m just guessing at things at this point.

I am on ruby-2.3.1 w/ fast_gettext-1.2.0

On Mon, Sep 5, 2016 at 4:13 AM, Martin Bačovský <martin.bacovsky@gmail.com > > wrote:

Recently there were some changes in how the translation domains are
handled in hammer with new fast_gettext. See the PR [1] for more details.
There was hammer 0.8.0 gem released last week containing the changes.
What hammer version anf fast_gettext do you use?

I checked the hammer-cli-csv PR and I’m not sure why are you adding the
domain manualy for the second time and not only with HammerCLI::I18n.add_domain
but it was not necessary for hammer-cli-foreman.

[1] https://github.com/theforeman/hammer-cli/commit/6e28b70ff1a0
5344b0af7abd5a2f660d74ba6df7

On Fri, Sep 2, 2016 at 9:44 PM, Tom McKay thomasmckay@redhat.com wrote:

Opened a PR that works but I’d like to understand the problem and what
changed, if anyone has any insights.
https://github.com/Katello/hammer-cli-csv/pull/121

On Fri, Sep 2, 2016 at 1:14 PM, Tom McKay thomasmckay@redhat.com >>> wrote:

I get an error “RuntimeError (Current textdomain (nil) was not added,
use FastGettext.add_text_domain !” during a call to hammer.run() from w/in
another hammer command. Effectively ‘hammer csv subscriptions’ is calling
’hammer subscription upload’ from w/in itself. If I add this code[1] prior
to calling hammer.run() then things work as expected (and as it had
previously).

What is the proper way to config FastGettext in hammer module?

[1] https://github.com/thomasmckay/hammer-cli-csv/blob/fastgette
xt/lib/hammer_cli_csv/subscriptions.rb#L62-L68


You received this message because you are subscribed to the Google
Groups “foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Seems it has to do with threads. hammer-cli-csv supports processing the
input file divided equally between N number of threads. Is there some init
functionality required for fast_gettext per thread?

··· On Tue, Sep 6, 2016 at 8:07 PM, Tom McKay wrote:

This is blocking me now as it happens in lots of commands. Any suggestions
welcome. Maybe I need to create some mo files or something?

On Tue, Sep 6, 2016 at 10:06 AM, Tom McKay thomasmckay@redhat.com wrote:

Without the lines add_text_domain the errors happen. Could be that
katello is not initialized at the time I am calling hammer.run() for one of
its commands? I’m just guessing at things at this point.

I am on ruby-2.3.1 w/ fast_gettext-1.2.0

On Mon, Sep 5, 2016 at 4:13 AM, Martin Bačovský < >> martin.bacovsky@gmail.com> wrote:

Recently there were some changes in how the translation domains are
handled in hammer with new fast_gettext. See the PR [1] for more details.
There was hammer 0.8.0 gem released last week containing the changes.
What hammer version anf fast_gettext do you use?

I checked the hammer-cli-csv PR and I’m not sure why are you adding the
domain manualy for the second time and not only with HammerCLI::I18n.add_domain
but it was not necessary for hammer-cli-foreman.

[1] https://github.com/theforeman/hammer-cli/commit/6e28b70ff1a0
5344b0af7abd5a2f660d74ba6df7

On Fri, Sep 2, 2016 at 9:44 PM, Tom McKay thomasmckay@redhat.com >>> wrote:

Opened a PR that works but I’d like to understand the problem and what
changed, if anyone has any insights.
https://github.com/Katello/hammer-cli-csv/pull/121

On Fri, Sep 2, 2016 at 1:14 PM, Tom McKay thomasmckay@redhat.com >>>> wrote:

I get an error “RuntimeError (Current textdomain (nil) was not added,
use FastGettext.add_text_domain !” during a call to hammer.run() from w/in
another hammer command. Effectively ‘hammer csv subscriptions’ is calling
’hammer subscription upload’ from w/in itself. If I add this code[1] prior
to calling hammer.run() then things work as expected (and as it had
previously).

What is the proper way to config FastGettext in hammer module?

[1] https://github.com/thomasmckay/hammer-cli-csv/blob/fastgette
xt/lib/hammer_cli_csv/subscriptions.rb#L62-L68


You received this message because you are subscribed to the Google
Groups “foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google
Groups “foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.