Revision eb765213 snf-astakos-app/astakos/scripts/snf-component-register

b/snf-astakos-app/astakos/scripts/snf-component-register
42 42

  
43 43
register_component () {
44 44
    component=$1
45
    exists=$2
45 46
    component_desc=${desc[$component]}
46 47
    component_ex_url=${ex_url[$component]}
47 48
    echo "Registering the $component_desc ($component):"
......
55 56
    read ui_url
56 57
    decide "Register $component with the given URLs (y/n)? "
57 58
    if [ $? -eq 0 ]; then
58
        snf-manage component-add $component $ui_url
59
        if [ $? -eq 0 ]; then
60
            read -p "Please write down the token and press Enter to continue. "
61
            register_services $component $base_url
62
            changed=1
63
            echo
59
        if [ $exists -eq 0 ]; then
60
            snf-manage component-add $component --base-url $base_url \
61
                --ui-url $ui_url
62
            if [ $? -eq 0 ]; then
63
                read -p "Please write down the token and press Enter to continue. "
64
                changed=1
65
            fi
66
        else
67
            snf-manage component-modify $component --base-url $base_url \
68
                --ui-url $ui_url --purge-services
64 69
        fi
65
    fi
66
}
67

  
68
register_comp_serv () {
69
    component=$1
70
    component_desc=${desc[$component]}
71
    component_ex_url=${ex_url[$component]}
72
    echo "Registering services for $component:"
73
    echo "Give the URL of $component base installation" \
74
        "(e.g. $component_ex_url)"
75
    echo -n 'Base URL: '
76
    read base_url
77
    decide "Register ${component}'s services with the given URL (y/n)? "
78
    if [ $? -eq 0 ]; then
79 70
        register_services $component $base_url
80
        echo
81 71
    fi
82 72
}
83 73

  
......
91 81
    if [ $? -ne 0 ]; then
92 82
        decide "Register the ${desc[$component]} ($component) (y/n)? "
93 83
        if [ $? -eq 0 ]; then
94
            register_component $component
84
            register_component $component 0
95 85
        fi
96 86
    else
97 87
        echo "The ${desc[$component]} ($component) is registered."
98
        decide "Update its registered services (y/n)? "
88
        decide "Re-register (y/n)? "
99 89
        if [ $? -eq 0 ]; then
100
            register_comp_serv $component
90
            register_component $component 1
101 91
        fi
102 92
    fi
103 93
}

Also available in: Unified diff