Proxy development

Hi! I'm writing a proxy to communicate with an IPA server . . . the proxy will add the new host on the IPA server, then pass back a password for the client to use when it attempts to join the realm as a final step of provisioning. The proxy is coming along - I can get some json back when I hit the new URL ipasserver:8443/realm/hostname.domain - but I'm getting this error when trying to add the proxy to Foreman:

Unable to save

  • Unable to communicate with the proxy: Feature(#70075496721860) expected, got NilClass(#70075545332620)
  • Please check the proxy is configured and running on the host before saving.
··· * * * My logs aren't telling me much when this happens . . . does anyone recognize this? * * Looks like I also have to add a class for the new proxy on the foreman server in /usr/share/foreman/lib/proxy_api.rb . . ? Is this documented anywhere? * * Thanks a lot!! * Guy Matz

Curl request works, so what could be missing?

[root@foreman lib]# curl -H "Accept: application/json" http://ipadevmstr.collmedia.net:8443/features
["dhcp","dns","realm"]

Thanks again,
Guy

··· On 05/23/2013 04:06 PM, Guy Matz wrote: Hi! I'm writing a proxy to communicate with an IPA server . . . the proxy will add the new host on the IPA server, then pass back a password for the client to use when it attempts to join the realm as a final step of provisioning. The proxy is coming along - I can get some json back when I hit the new URL ipasserver:8443/realm/hostname.domain - but I'm getting this error when trying to add the proxy to Foreman:

Unable to save

  • Unable to communicate with the proxy: Feature(#70075496721860) expected, got NilClass(#70075545332620)
  • Please check the proxy is configured and running on the host before saving.
  • My logs aren’t telling me much when this happens . . . does anyone recognize this?
  • Looks like I also have to add a class for the new proxy on the foreman server in /usr/share/foreman/lib/proxy_api.rb . . ? Is this documented anywhere?
  • Thanks a lot!!
  • Guy Matz

    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.commailto:foreman-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

> Hi! I'm writing a proxy to communicate with an IPA server . . . the
> proxy will add the new host on the IPA server, then pass back a password
> for the client to use when it attempts to join the realm as a final step
> of provisioning. The proxy is coming along - I can get some json back
> when I hit the new URL ipasserver:8443/realm/hostname.domain - but I'm
> getting this error when trying to add the proxy to Foreman:
>
>
>
> Unable to save
>
> # Unable to communicate with the proxy: Feature(#70075496721860) expected,
> got NilClass(#70075545332620)

I suspect you need to add knowledge of the "feature" to Foreman as
you're adding a new API to the proxy.

Have a look at db/migrate/20120927020752_add_bmc_feature_to_proxy.rb
which adds the BMC feature to the Foreman database, you'd need to do
something similar.

> # Looks like I also have to add a class for the new proxy on the foreman
> server in /usr/share/foreman/lib/proxy_api.rb . . ? Is this documented
> anywhere?

No docs, but yes, that's the code that Foreman will call internally and
maps the REST API into a small library that Foreman core can use.

··· On 23/05/13 21:06, Guy Matz wrote:


Dominic Cleal
Red Hat Engineering

If so, we should probably add a small amount of code to Foreman to make it
ignore unknown features - then pluggable proxies can be extended without
breaking Foreman.

··· On 24 May 2013 14:49, Dominic Cleal wrote:

I suspect you need to add knowledge of the “feature” to Foreman as
you’re adding a new API to the proxy.

I'm trying to debug, so I tried to remove realm as a feature, but I can't seem to remove it! . . . I'm still getting realm as a feature:
[root@foreman db]# curl -H "Accept: application/json" http://ipadevmstr.collmedia.net:8443/features
["dhcp","dns","realm"]

Even when I've commented out realm from my foreman-proxy/settings!
[root@ipadevmstr foreman-proxy]# pwd
/etc/foreman-proxy
[root@ipadevmstr foreman-proxy]# grep realm settings.yml
#:realm: false
#:realm_vendor: ipa
#:realm_tsig_keytab: /etc/named.keytab
#:realm_tsig_principal: DNS/ipadevmstr.collmedia.net@COLLMEDIA.NET<mailto:DNS/ipadevmstr.collmedia.net@COLLMEDIA.NET>
[root@ipadevmstr foreman-proxy]# service foreman-proxy restart
Stopping foreman-proxy: [ OK ]
Starting foreman-proxy: WARNING: Missing SSL setup, working in clear text mode !

from /usr/share/foreman-proxy/bin/../lib/smart_proxy.rb:52
                                                       [  OK  ]

[root@ipadevmstr foreman-proxy]# curl -H "Accept: application/json" http://ipadevmstr.collmedia.net:8443/features
["dhcp","dns","realm"]
[root@ipadevmstr foreman-proxy]# egrep 'dns:|dhcp:|realm:' settings.yml
:dns: true
:dhcp: true
#:realm: false

Anyone have any idea why realm is still showing up as a supported proxy?

@Dominic: Is realm OK? Do you have a more appropriate name for the proxy?

In any event, I'm still getting this error: Unable to communicate with the proxy: Feature(#70075497817440) expected, got NilClass(#70075545332620)

I've added knowledge of the proxy to the foreman server:
[root@foreman lib]# pwd
/usr/share/foreman/lib
[root@foreman lib]# grep Realm proxy_api.rb
class Realm < Resource
# Creates a Realm Host entry
# Deletes a Realm Host entry

And my DB:
[root@foreman db]# sqlite3 production.sqlite3
SQLite version 3.6.20
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
> select * from features where name='Realm';
7|Realm|2013-05-24 14:21:38.447670|2013-05-24 14:21:38.447670

Again, any help is appreciated. :frowning:

Regards,
Guy

··· On 05/24/2013 09:49 AM, Dominic Cleal wrote:

On 23/05/13 21:06, Guy Matz wrote:

Hi! I’m writing a proxy to communicate with an IPA server . . . the
proxy will add the new host on the IPA server, then pass back a password
for the client to use when it attempts to join the realm as a final step
of provisioning. The proxy is coming along - I can get some json back
when I hit the new URL ipasserver:8443/realm/hostname.domain - but I’m
getting this error when trying to add the proxy to Foreman:

    Unable to save

Unable to communicate with the proxy: Feature(#70075496721860) expected,

got NilClass(#70075545332620)

I suspect you need to add knowledge of the “feature” to Foreman as
you’re adding a new API to the proxy.

Have a look at db/migrate/20120927020752_add_bmc_feature_to_proxy.rb
which adds the BMC feature to the Foreman database, you’d need to do
something similar.

Looks like I also have to add a class for the new proxy on the foreman

server in /usr/share/foreman/lib/proxy_api.rb . . ? Is this documented
anywhere?

No docs, but yes, that’s the code that Foreman will call internally and
maps the REST API into a small library that Foreman core can use.

Sorry! False alarm with the apparent weirdness below: the development version I'm working with uses foreman-proxy/config/settings.yaml, not the link to /etc/foreman-proxy/settings.yaml . . .

other issues persist . . .

Thanks,
Guy

I'm trying to debug, so I tried to remove realm as a feature, but I can't seem to remove it! . . . I'm still getting realm as a feature:
[root@foreman db]# curl -H "Accept: application/json" http://ipadevmstr.collmedia.net:8443/features
["dhcp","dns","realm"]

Even when I've commented out realm from my foreman-proxy/settings!
[root@ipadevmstr foreman-proxy]# pwd
/etc/foreman-proxy
[root@ipadevmstr foreman-proxy]# grep realm settings.yml
#:realm: false
#:realm_vendor: ipa
#:realm_tsig_keytab: /etc/named.keytab
#:realm_tsig_principal: DNS/ipadevmstr.collmedia.net@COLLMEDIA.NET<mailto:DNS/ipadevmstr.collmedia.net@COLLMEDIA.NET>
[root@ipadevmstr foreman-proxy]# service foreman-proxy restart
Stopping foreman-proxy: [ OK ]
Starting foreman-proxy: WARNING: Missing SSL setup, working in clear text mode !

from /usr/share/foreman-proxy/bin/../lib/smart_proxy.rb:52
                                                       [  OK  ]

[root@ipadevmstr foreman-proxy]# curl -H "Accept: application/json" http://ipadevmstr.collmedia.net:8443/features
["dhcp","dns","realm"]
[root@ipadevmstr foreman-proxy]# egrep 'dns:|dhcp:|realm:' settings.yml
:dns: true
:dhcp: true
#:realm: false

Anyone have any idea why realm is still showing up as a supported proxy?

@Dominic: Is realm OK? Do you have a more appropriate name for the proxy?

In any event, I'm still getting this error: Unable to communicate with the proxy: Feature(#70075497817440) expected, got NilClass(#70075545332620)

I've added knowledge of the proxy to the foreman server:
[root@foreman lib]# pwd
/usr/share/foreman/lib
[root@foreman lib]# grep Realm proxy_api.rb
class Realm < Resource
# Creates a Realm Host entry
# Deletes a Realm Host entry

And my DB:
[root@foreman db]# sqlite3 production.sqlite3
SQLite version 3.6.20
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
> select * from features where name='Realm';
7|Realm|2013-05-24 14:21:38.447670|2013-05-24 14:21:38.447670

Again, any help is appreciated. :frowning:

Regards,
Guy

··· On 05/24/2013 11:54 AM, Guy Matz wrote:

On 05/24/2013 09:49 AM, Dominic Cleal wrote:

On 23/05/13 21:06, Guy Matz wrote:

Hi! I’m writing a proxy to communicate with an IPA server . . . the
proxy will add the new host on the IPA server, then pass back a password
for the client to use when it attempts to join the realm as a final step
of provisioning. The proxy is coming along - I can get some json back
when I hit the new URL ipasserver:8443/realm/hostname.domain - but I’m
getting this error when trying to add the proxy to Foreman:

    Unable to save

Unable to communicate with the proxy: Feature(#70075496721860) expected,

got NilClass(#70075545332620)

I suspect you need to add knowledge of the “feature” to Foreman as
you’re adding a new API to the proxy.

Have a look at db/migrate/20120927020752_add_bmc_feature_to_proxy.rb
which adds the BMC feature to the Foreman database, you’d need to do
something similar.

Looks like I also have to add a class for the new proxy on the foreman

server in /usr/share/foreman/lib/proxy_api.rb . . ? Is this documented
anywhere?

No docs, but yes, that’s the code that Foreman will call internally and
maps the REST API into a small library that Foreman core can use.


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.commailto:foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Got it! Needed to add the new proxy to a few more files on the foreman server . . .

  • Add new feature in DB

[root@foreman foreman]# rails generate migration add_realm_feature_to_proxy
[root@foreman foreman]# cat db/migrate/20130524140440_add_realm_feature_to_proxy.rb
class AddRealmFeatureToProxy < ActiveRecord::Migration
def self.up
Feature.find_or_create_by_name("Realm")
end
def self.down
end
end
[root@foreman foreman]# RAILS_ENV=production bundle exec rake db:migrate VERSION=20130524140440

  • Add new proxy in these files on the foreman server
  • app/models/smart_proxy.rb
  • ProxyFeatures array
  • def self.name_map anon hash
  • lib/proxy_api.rb
  • New class named the same (& same case?) as was added to DB above

Thanks!
Guy

Sorry! False alarm with the apparent weirdness below: the development version I'm working with uses foreman-proxy/config/settings.yaml, not the link to /etc/foreman-proxy/settings.yaml . . .

other issues persist . . .

Thanks,
Guy

I'm trying to debug, so I tried to remove realm as a feature, but I can't seem to remove it! . . . I'm still getting realm as a feature:
[root@foreman db]# curl -H "Accept: application/json" http://ipadevmstr.collmedia.net:8443/features
["dhcp","dns","realm"]

Even when I've commented out realm from my foreman-proxy/settings!
[root@ipadevmstr foreman-proxy]# pwd
/etc/foreman-proxy
[root@ipadevmstr foreman-proxy]# grep realm settings.yml
#:realm: false
#:realm_vendor: ipa
#:realm_tsig_keytab: /etc/named.keytab
#:realm_tsig_principal: DNS/ipadevmstr.collmedia.net@COLLMEDIA.NET<mailto:DNS/ipadevmstr.collmedia.net@COLLMEDIA.NET>
[root@ipadevmstr foreman-proxy]# service foreman-proxy restart
Stopping foreman-proxy: [ OK ]
Starting foreman-proxy: WARNING: Missing SSL setup, working in clear text mode !

from /usr/share/foreman-proxy/bin/../lib/smart_proxy.rb:52
                                                       [  OK  ]

[root@ipadevmstr foreman-proxy]# curl -H "Accept: application/json" http://ipadevmstr.collmedia.net:8443/features
["dhcp","dns","realm"]
[root@ipadevmstr foreman-proxy]# egrep 'dns:|dhcp:|realm:' settings.yml
:dns: true
:dhcp: true
#:realm: false

Anyone have any idea why realm is still showing up as a supported proxy?

@Dominic: Is realm OK? Do you have a more appropriate name for the proxy?

In any event, I'm still getting this error: Unable to communicate with the proxy: Feature(#70075497817440) expected, got NilClass(#70075545332620)

I've added knowledge of the proxy to the foreman server:
[root@foreman lib]# pwd
/usr/share/foreman/lib
[root@foreman lib]# grep Realm proxy_api.rb
class Realm < Resource
# Creates a Realm Host entry
# Deletes a Realm Host entry

And my DB:
[root@foreman db]# sqlite3 production.sqlite3
SQLite version 3.6.20
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
> select * from features where name='Realm';
7|Realm|2013-05-24 14:21:38.447670|2013-05-24 14:21:38.447670

Again, any help is appreciated. :frowning:

Regards,
Guy

··· On 05/24/2013 12:42 PM, Guy Matz wrote: On 05/24/2013 11:54 AM, Guy Matz wrote:

On 05/24/2013 09:49 AM, Dominic Cleal wrote:

On 23/05/13 21:06, Guy Matz wrote:

Hi! I’m writing a proxy to communicate with an IPA server . . . the
proxy will add the new host on the IPA server, then pass back a password
for the client to use when it attempts to join the realm as a final step
of provisioning. The proxy is coming along - I can get some json back
when I hit the new URL ipasserver:8443/realm/hostname.domain - but I’m
getting this error when trying to add the proxy to Foreman:

    Unable to save

Unable to communicate with the proxy: Feature(#70075496721860) expected,

got NilClass(#70075545332620)

I suspect you need to add knowledge of the “feature” to Foreman as
you’re adding a new API to the proxy.

Have a look at db/migrate/20120927020752_add_bmc_feature_to_proxy.rb
which adds the BMC feature to the Foreman database, you’d need to do
something similar.

Looks like I also have to add a class for the new proxy on the foreman

server in /usr/share/foreman/lib/proxy_api.rb . . ? Is this documented
anywhere?

No docs, but yes, that’s the code that Foreman will call internally and
maps the REST API into a small library that Foreman core can use.


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.commailto:foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


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.commailto:foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.