[openstack-dev] [fuel][puppet] Detached roles and globals.pp

2015-11-11 Thread Daniel Depaoli
Hi all.
I'm starting to resolve the todo at these line[1]. To solve this I think to
hardcoded the role in the file, for example:

*$swift_proxies = get_nodes_hash_by_roles($network_metadata,
['primary-swift-proxy', 'swift-proxy']) ? {*
*true => get_nodes_hash_by_roles($network_metadata,
['primary-swift-proxy', 'swift-proxy']),*
*false => get_nodes_hash_by_roles($network_metadata,
['primary-controller', 'controller']),*
*}*


Is this the right way or do you suggest something more clean?

Thanks

[1]
https://github.com/openstack/fuel-library/blob/master/deployment/puppet/osnailyfacter/modular/globals/globals.pp#L236:L242

-- 

Daniel Depaoli
CREATE-NET Research Center
Smart Infrastructures Area
Junior Research Engineer

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [fuel][puppet] Detached roles and globals.pp

2015-11-11 Thread Sergey Vasilenko
On Wed, Nov 11, 2015 at 1:41 PM, Daniel Depaoli <
daniel.depa...@create-net.org> wrote:

> Hi all.
> I'm starting to resolve the todo at these line[1]. To solve this I think
> to hardcoded the role in the file, for example:
>
> *$swift_proxies = get_nodes_hash_by_roles($network_metadata,
> ['primary-swift-proxy', 'swift-proxy']) ? {*
> *true => get_nodes_hash_by_roles($network_metadata,
> ['primary-swift-proxy', 'swift-proxy']),*
> *false => get_nodes_hash_by_roles($network_metadata,
> ['primary-controller', 'controller']),*
> *}*
>
>
> Is this the right way or do you suggest something more clean?
>

Function *get_nodes_hash_by_roles returns *hash*. *Provided above switch
shouldn't work. But this way is true.
IMHO list of roles name should be constructed before.


/sv
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [fuel][puppet] Detached roles and globals.pp

2015-11-11 Thread Aleksandr Didenko
Hi,

I think something like this would be more flexible:

$swift_proxy_roles   = hiera('swift_proxy_roles', ['primary-controller',
'controller'])
$swift_storage_roles = hiera('swift_storage_roles', ['primary-controller',
'controller'])
# ...
$swift_nodes = get_nodes_hash_by_roles($network_metadata,
$swift_storage_roles)
$swift_proxies   = get_nodes_hash_by_roles($network_metadata,
$swift_proxy_roles)
$swift_proxy_caches  = get_nodes_hash_by_roles($network_metadata,
$swift_proxy_roles)

Regards,
Alex


On Wed, Nov 11, 2015 at 12:41 PM, Daniel Depaoli <
daniel.depa...@create-net.org> wrote:

> Hi all.
> I'm starting to resolve the todo at these line[1]. To solve this I think
> to hardcoded the role in the file, for example:
>
> *$swift_proxies = get_nodes_hash_by_roles($network_metadata,
> ['primary-swift-proxy', 'swift-proxy']) ? {*
> *true => get_nodes_hash_by_roles($network_metadata,
> ['primary-swift-proxy', 'swift-proxy']),*
> *false => get_nodes_hash_by_roles($network_metadata,
> ['primary-controller', 'controller']),*
> *}*
>
>
> Is this the right way or do you suggest something more clean?
>
> Thanks
>
> [1]
> https://github.com/openstack/fuel-library/blob/master/deployment/puppet/osnailyfacter/modular/globals/globals.pp#L236:L242
>
> --
> 
> Daniel Depaoli
> CREATE-NET Research Center
> Smart Infrastructures Area
> Junior Research Engineer
> 
>
> __
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [fuel][puppet] Detached roles and globals.pp

2015-11-11 Thread Daniel Depaoli
With before you mean before in globals.pp or in another module? The best
solution should be add it in override plugin module, but it is executed
after globals so it has no effect on globals.

On Wed, Nov 11, 2015 at 12:13 PM, Sergey Vasilenko 
wrote:

>
> On Wed, Nov 11, 2015 at 1:41 PM, Daniel Depaoli <
> daniel.depa...@create-net.org> wrote:
>
>> Hi all.
>> I'm starting to resolve the todo at these line[1]. To solve this I think
>> to hardcoded the role in the file, for example:
>>
>> *$swift_proxies = get_nodes_hash_by_roles($network_metadata,
>> ['primary-swift-proxy', 'swift-proxy']) ? {*
>> *true => get_nodes_hash_by_roles($network_metadata,
>> ['primary-swift-proxy', 'swift-proxy']),*
>> *false => get_nodes_hash_by_roles($network_metadata,
>> ['primary-controller', 'controller']),*
>> *}*
>>
>>
>> Is this the right way or do you suggest something more clean?
>>
>
> Function *get_nodes_hash_by_roles returns *hash*. *Provided above switch
> shouldn't work. But this way is true.
> IMHO list of roles name should be constructed before.
>
>
> /sv
>
> __
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>


-- 

Daniel Depaoli
CREATE-NET Research Center
Smart Infrastructures Area
Junior Research Engineer

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev