diff options
Diffstat (limited to 'meta-openstack/classes')
| -rw-r--r-- | meta-openstack/classes/monitor.bbclass | 22 | ||||
| -rw-r--r-- | meta-openstack/classes/openstackchef_inc.bbclass | 28 |
2 files changed, 25 insertions, 25 deletions
diff --git a/meta-openstack/classes/monitor.bbclass b/meta-openstack/classes/monitor.bbclass index a959f09..e916137 100644 --- a/meta-openstack/classes/monitor.bbclass +++ b/meta-openstack/classes/monitor.bbclass | |||
| @@ -12,7 +12,7 @@ addtask monitor_clean before do_clean | |||
| 12 | def copy_check_files(d, check_var_name, src, dest): | 12 | def copy_check_files(d, check_var_name, src, dest): |
| 13 | import shutil | 13 | import shutil |
| 14 | 14 | ||
| 15 | mon_checks = bb.data.getVar(check_var_name, d, 1) | 15 | mon_checks = d.getVar(check_var_name, 1) |
| 16 | if mon_checks != None: | 16 | if mon_checks != None: |
| 17 | if not os.path.exists(dest): | 17 | if not os.path.exists(dest): |
| 18 | os.makedirs(dest) | 18 | os.makedirs(dest) |
| @@ -29,9 +29,9 @@ python do_monitor_install() { | |||
| 29 | bb.debug(1, 'OpenStack monitoring feature is disabled, skipping do_monitor_install') | 29 | bb.debug(1, 'OpenStack monitoring feature is disabled, skipping do_monitor_install') |
| 30 | return | 30 | return |
| 31 | 31 | ||
| 32 | mon_dir = bb.data.getVar('MONITOR_STAGING_DIR', d, 1) | 32 | mon_dir = d.getVar('MONITOR_STAGING_DIR', 1) |
| 33 | mon_services_dir = bb.data.getVar('MONITOR_STAGING_SERVICES_DIR', d, 1) | 33 | mon_services_dir = d.getVar('MONITOR_STAGING_SERVICES_DIR', 1) |
| 34 | mon_checks_dir = bb.data.getVar('MONITOR_STAGING_CHECKS_DIR', d, 1) | 34 | mon_checks_dir = d.getVar('MONITOR_STAGING_CHECKS_DIR', 1) |
| 35 | if not os.path.exists(mon_dir): | 35 | if not os.path.exists(mon_dir): |
| 36 | os.makedirs(mon_dir) | 36 | os.makedirs(mon_dir) |
| 37 | if not os.path.exists(mon_services_dir): | 37 | if not os.path.exists(mon_services_dir): |
| @@ -41,13 +41,13 @@ python do_monitor_install() { | |||
| 41 | workdir = d.getVar('WORKDIR', True) | 41 | workdir = d.getVar('WORKDIR', True) |
| 42 | 42 | ||
| 43 | # Process monitor SERVICE catagory | 43 | # Process monitor SERVICE catagory |
| 44 | mon_service_pkgs = bb.data.getVar('MONITOR_SERVICE_PACKAGES', d, 1) | 44 | mon_service_pkgs = d.getVar('MONITOR_SERVICE_PACKAGES', 1) |
| 45 | if mon_service_pkgs != None: | 45 | if mon_service_pkgs != None: |
| 46 | for pkg in mon_service_pkgs.split(): | 46 | for pkg in mon_service_pkgs.split(): |
| 47 | f_name = os.path.join(mon_services_dir, pkg + '.service') | 47 | f_name = os.path.join(mon_services_dir, pkg + '.service') |
| 48 | if os.path.exists(f_name): | 48 | if os.path.exists(f_name): |
| 49 | os.remove(f_name) | 49 | os.remove(f_name) |
| 50 | data = bb.data.getVar('MONITOR_SERVICE_' + pkg, d, 1) | 50 | data = d.getVar('MONITOR_SERVICE_' + pkg, 1) |
| 51 | if data != None: | 51 | if data != None: |
| 52 | f = open(f_name, 'w') | 52 | f = open(f_name, 'w') |
| 53 | f.write(d.getVar('MONITOR_SERVICE_' + pkg)) | 53 | f.write(d.getVar('MONITOR_SERVICE_' + pkg)) |
| @@ -62,14 +62,14 @@ python do_monitor_install() { | |||
| 62 | python do_monitor_clean() { | 62 | python do_monitor_clean() { |
| 63 | import shutil | 63 | import shutil |
| 64 | 64 | ||
| 65 | mon_dir = bb.data.getVar('MONITOR_STAGING_DIR', d, 1) | 65 | mon_dir = d.getVar('MONITOR_STAGING_DIR', 1) |
| 66 | mon_services_dir = bb.data.getVar('MONITOR_STAGING_SERVICES_DIR', d, 1) | 66 | mon_services_dir = d.getVar('MONITOR_STAGING_SERVICES_DIR', 1) |
| 67 | mon_checks_dir = bb.data.getVar('MONITOR_STAGING_CHECKS_DIR', d, 1) | 67 | mon_checks_dir = d.getVar('MONITOR_STAGING_CHECKS_DIR', 1) |
| 68 | if not os.path.exists(mon_dir): | 68 | if not os.path.exists(mon_dir): |
| 69 | return | 69 | return |
| 70 | 70 | ||
| 71 | # Clean up monitor SERVICE catagory | 71 | # Clean up monitor SERVICE catagory |
| 72 | mon_service_pkgs = bb.data.getVar('MONITOR_SERVICE_PACKAGES', d, 1) | 72 | mon_service_pkgs = d.getVar('MONITOR_SERVICE_PACKAGES', 1) |
| 73 | if mon_service_pkgs != None and os.path.exists(mon_services_dir): | 73 | if mon_service_pkgs != None and os.path.exists(mon_services_dir): |
| 74 | for pkg in mon_service_pkgs.split(): | 74 | for pkg in mon_service_pkgs.split(): |
| 75 | f_name = os.path.join(mon_services_dir, pkg + '.service') | 75 | f_name = os.path.join(mon_services_dir, pkg + '.service') |
| @@ -80,7 +80,7 @@ python do_monitor_clean() { | |||
| 80 | packages = (d.getVar('PACKAGES', True) or "").split() | 80 | packages = (d.getVar('PACKAGES', True) or "").split() |
| 81 | if len(packages) >= 1 and os.path.exists(mon_checks_dir): | 81 | if len(packages) >= 1 and os.path.exists(mon_checks_dir): |
| 82 | for pkg in packages: | 82 | for pkg in packages: |
| 83 | if bb.data.getVar('MONITOR_CHECKS_' + pkg, d, 1) != None: | 83 | if d.getVar('MONITOR_CHECKS_' + pkg, 1) != None: |
| 84 | shutil.rmtree(mon_checks_dir + "/" + pkg, True) | 84 | shutil.rmtree(mon_checks_dir + "/" + pkg, True) |
| 85 | } | 85 | } |
| 86 | 86 | ||
diff --git a/meta-openstack/classes/openstackchef_inc.bbclass b/meta-openstack/classes/openstackchef_inc.bbclass index 048fce6..91adb41 100644 --- a/meta-openstack/classes/openstackchef_inc.bbclass +++ b/meta-openstack/classes/openstackchef_inc.bbclass | |||
| @@ -184,12 +184,12 @@ def deploychef_make_startup_shutdown_list(d): | |||
| 184 | 184 | ||
| 185 | import os | 185 | import os |
| 186 | if d.getVar('INITSCRIPT_PACKAGES') or d.getVar('INITSCRIPT_NAME'): | 186 | if d.getVar('INITSCRIPT_PACKAGES') or d.getVar('INITSCRIPT_NAME'): |
| 187 | #script_list = bb.data.getVar('INITSCRIPT_PACKAGES', d , 1) | 187 | #script_list = d.getVar('INITSCRIPT_PACKAGES', 1) |
| 188 | script_list = d.getVar('INITSCRIPT_PACKAGES', True) or \ | 188 | script_list = d.getVar('INITSCRIPT_PACKAGES', True) or \ |
| 189 | d.getVar('INITSCRIPT_NAME', True) #Some package do not define INITSCRIPT_PACKAGES | 189 | d.getVar('INITSCRIPT_NAME', True) #Some package do not define INITSCRIPT_PACKAGES |
| 190 | msg="list of start/stop services: %s" % str(script_list) | 190 | msg="list of start/stop services: %s" % str(script_list) |
| 191 | bb.debug(2, msg) | 191 | bb.debug(2, msg) |
| 192 | base_dir = bb.data.getVar('CHEF_TEMPLATE_BASE', d, 1 ) | 192 | base_dir = d.getVar('CHEF_TEMPLATE_BASE', 1 ) |
| 193 | if not os.path.exists(base_dir): | 193 | if not os.path.exists(base_dir): |
| 194 | os.mkdir(base_dir) | 194 | os.mkdir(base_dir) |
| 195 | startup_file = os.path.join(base_dir, d.getVar('SRCNAME', True) +'-startup-list') | 195 | startup_file = os.path.join(base_dir, d.getVar('SRCNAME', True) +'-startup-list') |
| @@ -311,15 +311,15 @@ def deploychef_make_substitutions(d, sub_dict, attr_filename, sed_filename): | |||
| 311 | hFile.close() | 311 | hFile.close() |
| 312 | if False: | 312 | if False: |
| 313 | msg = "Cannot read/write to attributes file %s as expected:%s"\ | 313 | msg = "Cannot read/write to attributes file %s as expected:%s"\ |
| 314 | % (attr_filename, bb.data.getVar('FILE', d)) | 314 | % (attr_filename, d.getVar('FILE')) |
| 315 | bb.build.FuncFailed(msg) | 315 | bb.build.FuncFailed(msg) |
| 316 | else: | 316 | else: |
| 317 | msg = "The substitution dictionary variable sub_dict is not set %s as expected "\ | 317 | msg = "The substitution dictionary variable sub_dict is not set %s as expected "\ |
| 318 | % bb.data.getVar('FILE') | 318 | % d.getVar('FILE') |
| 319 | bb.error(msg) | 319 | bb.error(msg) |
| 320 | else: | 320 | else: |
| 321 | msg = "Null file names passsed to function %s %s "\ | 321 | msg = "Null file names passsed to function %s %s "\ |
| 322 | % (bb.data.getVar('FUNC',d), bb.data.getVar('FILE', d)) | 322 | % (d.getVar('FUNC'), d.getVar('FILE')) |
| 323 | bb.error(msg) | 323 | bb.error(msg) |
| 324 | 324 | ||
| 325 | 325 | ||
| @@ -338,7 +338,7 @@ def deploychef_make_templates( d, conf_tuple=tuple()): | |||
| 338 | 338 | ||
| 339 | if len(conf_tuple): | 339 | if len(conf_tuple): |
| 340 | import os, ast | 340 | import os, ast |
| 341 | base_dir = bb.data.getVar('CHEF_TEMPLATE_BASE', d, 1 ) | 341 | base_dir = d.getVar('CHEF_TEMPLATE_BASE', 1 ) |
| 342 | attr_file = os.path.join(base_dir, d.getVar('SRCNAME', True) + '-attributes.rb') | 342 | attr_file = os.path.join(base_dir, d.getVar('SRCNAME', True) + '-attributes.rb') |
| 343 | msg ="Default attributes saved to %s" % attr_file | 343 | msg ="Default attributes saved to %s" % attr_file |
| 344 | if os.path.exists(attr_file): | 344 | if os.path.exists(attr_file): |
| @@ -357,9 +357,9 @@ def deploychef_make_templates( d, conf_tuple=tuple()): | |||
| 357 | 357 | ||
| 358 | #Make the necessary susbstitutions using the default | 358 | #Make the necessary susbstitutions using the default |
| 359 | #substitutiin dictionary | 359 | #substitutiin dictionary |
| 360 | sub_dict = bb.data.getVar('CHEF_SERVICES_DEFAULT_CONF_SUBS', d , 1) | 360 | sub_dict = d.getVar('CHEF_SERVICES_DEFAULT_CONF_SUBS', 1) |
| 361 | msg = "The variable %s is not set in %s as a dictionary as expected "\ | 361 | msg = "The variable %s is not set in %s as a dictionary as expected "\ |
| 362 | % ('CHEF_SERVICES_DEFAULT_CONF_SUBS', bb.data.getVar('FILE', d)) | 362 | % ('CHEF_SERVICES_DEFAULT_CONF_SUBS', d.getVar('FILE')) |
| 363 | if sub_dict: | 363 | if sub_dict: |
| 364 | #Safely retrieve our python data structure | 364 | #Safely retrieve our python data structure |
| 365 | sub_dict = ast.literal_eval(sub_dict) | 365 | sub_dict = ast.literal_eval(sub_dict) |
| @@ -371,11 +371,11 @@ def deploychef_make_templates( d, conf_tuple=tuple()): | |||
| 371 | raise bb.build.FuncFailed(msg) | 371 | raise bb.build.FuncFailed(msg) |
| 372 | #Make the necessary susbstitutions using auxilliary dictionary | 372 | #Make the necessary susbstitutions using auxilliary dictionary |
| 373 | #if provided by inheriting class | 373 | #if provided by inheriting class |
| 374 | sub_dict = bb.data.getVar('CHEF_SERVICES_CONF_SUBS', d , 1) | 374 | sub_dict = d.getVar('CHEF_SERVICES_CONF_SUBS', 1) |
| 375 | if sub_dict: | 375 | if sub_dict: |
| 376 | sub_dict = ast.literal_eval(sub_dict) | 376 | sub_dict = ast.literal_eval(sub_dict) |
| 377 | msg = "The variable %s is not set in %s as a dictionary as expected "\ | 377 | msg = "The variable %s is not set in %s as a dictionary as expected "\ |
| 378 | % ('CHEF_SERVICES_CONF_SUB', bb.data.getVar('FILE', d)) | 378 | % ('CHEF_SERVICES_CONF_SUB', d.getVar('FILE')) |
| 379 | if type(sub_dict) is dict: | 379 | if type(sub_dict) is dict: |
| 380 | pass | 380 | pass |
| 381 | deploychef_make_substitutions(d, sub_dict, attr_file, file_name) | 381 | deploychef_make_substitutions(d, sub_dict, attr_file, file_name) |
| @@ -530,11 +530,11 @@ def deploychef_postinst_substitutions(d, sub_dict, postinst): | |||
| 530 | hFile.close() | 530 | hFile.close() |
| 531 | else: | 531 | else: |
| 532 | msg = "The substitution dictionary variable sub_dict is not set %s as expected "\ | 532 | msg = "The substitution dictionary variable sub_dict is not set %s as expected "\ |
| 533 | % bb.data.getVar('FILE') | 533 | % d.getVar('FILE') |
| 534 | bb.build.FuncFailed(msg) | 534 | bb.build.FuncFailed(msg) |
| 535 | else: | 535 | else: |
| 536 | msg = "Null string passsed to function %s %s "\ | 536 | msg = "Null string passsed to function %s %s "\ |
| 537 | % (bb.data.getVar('FUNC',d), bb.data.getVar('FILE', d)) | 537 | % (d.getVar('FUNC'), d.getVar('FILE')) |
| 538 | bb.build.FuncFailed(msg) | 538 | bb.build.FuncFailed(msg) |
| 539 | return postinst | 539 | return postinst |
| 540 | 540 | ||
| @@ -565,9 +565,9 @@ def deploychef_update_package_postinsts(d): | |||
| 565 | overrides = d.getVar("OVERRIDES", True) | 565 | overrides = d.getVar("OVERRIDES", True) |
| 566 | msg = "%s The override variable is %s :\n %s " % (pkg, overrides, postinst) | 566 | msg = "%s The override variable is %s :\n %s " % (pkg, overrides, postinst) |
| 567 | bb.note(msg) | 567 | bb.note(msg) |
| 568 | sub_dict = bb.data.getVar('CHEF_SERVICES_DEFAULT_CONF_SUBS', d , 1) | 568 | sub_dict = d.getVar('CHEF_SERVICES_DEFAULT_CONF_SUBS', 1) |
| 569 | msg = "The variable %s is not set in %s as a dictionary as expected "\ | 569 | msg = "The variable %s is not set in %s as a dictionary as expected "\ |
| 570 | % ('CHEF_SERVICES_DEFAULT_CONF_SUBS', bb.data.getVar('FILE', d)) | 570 | % ('CHEF_SERVICES_DEFAULT_CONF_SUBS', d.getVar('FILE')) |
| 571 | if sub_dict: | 571 | if sub_dict: |
| 572 | import ast | 572 | import ast |
| 573 | #Safely retrieve our python data structure | 573 | #Safely retrieve our python data structure |
