Class: OneAclHelper

Inherits:
OpenNebulaHelper::OneHelper show all
Defined in:
lib/one_helper/oneacl_helper.rb

Overview

Helper for oneacl command

Instance Attribute Summary

Attributes inherited from OpenNebulaHelper::OneHelper

#client

Class Method Summary collapse

Methods inherited from OpenNebulaHelper::OneHelper

#backup_mode_valid?, #check_orphan, client, #create_resource, #filterflag_to_i, filterflag_to_i_desc, get_client, get_password, #group_name, #initialize, list_layout_help, #list_pool, #list_pool_format, #list_pool_table, #list_pool_top, #list_pool_xml, #list_to_id, list_to_id_desc, name_to_id, #perform_action, #perform_actions, #print_page, #retrieve_resource, #set_client, set_endpoint, set_password, set_user, #show_resource, #start_pager, #stop_pager, table_conf, template_input_help, #to_id, to_id_desc, #user_name

Constructor Details

This class inherits a constructor from OpenNebulaHelper::OneHelper

Class Method Details

.conf_fileObject



28
29
30
# File 'lib/one_helper/oneacl_helper.rb', line 28

def self.conf_file
    'oneacl.yaml'
end

.resource_mask(str) ⇒ Object

TODO: check that @content is valid



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/one_helper/oneacl_helper.rb', line 36

def self.resource_mask(str)
    resource_type=str.split('/')[0]

    mask = '-------------------'

    resource_type.split('+').each do |type|
        case type
        when 'VM'
            mask[0] = 'V'
        when 'HOST'
            mask[1] = 'H'
        when 'NET'
            mask[2] = 'N'
        when 'IMAGE'
            mask[3] = 'I'
        when 'USER'
            mask[4] = 'U'
        when 'TEMPLATE'
            mask[5] = 'T'
        when 'GROUP'
            mask[6] = 'G'
        when 'DATASTORE'
            mask[7] = 'D'
        when 'CLUSTER'
            mask[8] = 'C'
        when 'DOCUMENT'
            mask[9] = 'O'
        when 'ZONE'
            mask[10] = 'Z'
        when 'SECGROUP'
            mask[11] = 'S'
        when 'VDC'
            mask[12] = 'v'
        when 'VROUTER'
            mask[13] = 'R'
        when 'MARKETPLACE'
            mask[14] = 'M'
        when 'MARKETPLACEAPP'
            mask[15] = 'A'
        when 'VMGROUP'
            mask[16] = 'P'
        when 'VNTEMPLATE'
            mask[17] = 't'
        when 'BACKUPJOB'
            mask[18] = 'B'
        end
    end
    mask
end

.right_mask(str) ⇒ Object

TODO: check that @content is valid



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/one_helper/oneacl_helper.rb', line 87

def self.right_mask(str)
    mask = '----'

    str.split('+').each do |type|
        case type
        when 'USE'
            mask[0] = 'u'
        when 'MANAGE'
            mask[1] = 'm'
        when 'ADMIN'
            mask[2] = 'a'
        when 'CREATE'
            mask[3] = 'c'
        end
    end

    mask
end

.rnameObject



24
25
26
# File 'lib/one_helper/oneacl_helper.rb', line 24

def self.rname
    'ACL'
end