游侠的GET组

时间:2018-06-21 08:35:21

标签: shell get apache-ranger

我做了一个Shell代码来更新Yarn的护林员政策。我重新列出了Linux列表组。

update_yarn_policy() 
{
    log "Modification YARN policy for execution of job ${policyusecase} on the YARN queue."

    # If activite is "prod" we recovre all the groups of production.
    if [ "prod" == "${policyActivite}" ]
    then
        liste_group=$(cat /etc/group | grep "prod_.*" | awk -F: '{print $ 1}')
        # we build the policy name
        policyName="QueueProduction"
        # we On indicate the queue list of production
        queues="\"root.Production\""
    # Else, we indicate all the group except production
    else
        liste_group=$(cat /etc/group | grep ".*_.*" | grep -v "prod_.*" | awk -F: '{print $ 1}')
        # We build the policy name
        policyName="Realisation"
        # We indicate the queue list of realisation
        queues="\"root.Queue1\",\"root.Queue2\",\"root.Queue3\",\"root.Queue4\""
    fi

我想回顾游侠的名单。因此,我更改了我的代码,我用他在CURL中使用GET来重新获得该服务,但是我正在寻找如何重新获得Ranger中的组。我的代码如下:

update_yarn_policy() 
{
    log "Modification YARN policy for execution of job ${policyusecase} on the YARN queue."

    # If activite is "prod" we recovre all the groups of production.
    if [ "prod" == "${policyActivite}" ]
    then
        liste_group=$(curl -iv -u <user>:<password> -H "Content-type:application/json" -X GET http://horton01.example.com:6080/service/public/api/policy/2 | grep "prod_.*" | awk -F: '{print $ 1}')
        # we build the policy name
        policyName="Production"
        # we On indicate the queue list of production
        queues="\"root.Production\""
    # Else, we indicate all the group except production
    else
        liste_group=$(curl -iv -u <user>:<password> -H "Content-type:application/json" -X GET http://horton01.example.com:6080/service/public/api/policy/2 | grep ".*_.*" | grep -v "prod_.*" | awk -F: '{print $ 1}')
        # We build the policy name
        policyName="Realisation"
        # We indicate the queue list of realisation
        queues="\"root.Queue1\",\"root.Queue2\",\"root.Queue3\",\"root.Queue4\""

    fi

This solution doesn't work, How can I recovre the list group from Ranger ?

Thank you

0 个答案:

没有答案
相关问题