Forum Discussion

ccb's avatar
ccb
Icon for Employee rankEmployee
Feb 20, 2013

Using tmsh::delete to delete a profile created by create_http_comp_accel_profiles

Hi,

 

I have a scenario where I want to use my own custom wan-optimized compression profile and not the one that is automatically created with create_http_comp_accel_profiles.

 

Using tmsh_modify command in the implementation code I can remove the profile from the virtual server, however I'm not able to delete it completely. Therefore under the Components screen I still see the wan-optimized-compression profile created evene though the VS is not using it. This I understand, because removing it from the VS does not delete the profile.

 

The tmsh command I would like to use is in my implementation code is

 

tmsh delete ltm profile http-compression .app/

 

Presentation code:

 

 

section optimizations {

 

choice lan_or_wan { "WAN", "LAN" }

 

 

optional ( intro.wam_provisioned == "provisioned" ) {

 

noyes use_wa

 

optional ( use_wa == "Yes" ) {

 

table hosts {

 

string host required validator "FQDN" display "large"

 

}

 

choice x_wa_info_header default "None" {

 

"None" => "none",

 

"Standard" => "standard",

 

"Debug" => "debug"

 

}

 

choice perf_monitor default "disabled" {

 

"Enabled" => "enabled",

 

"Disabled" => "disabled"

 

}

 

optional ( perf_monitor == "enabled" ) {

 

string data_retention_period default "30" required validator "NonNegativeNumber"

 

}

 

choice policy display "xlarge" default "/Common/SAPWEB" tcl {

 

set results "/Common/SAPWEB\n"

 

append results [tmsh::run_proc f5.app_utils:get_custom_wa_policies]

 

return $results

 

}

 

}

 

}

 

 

noyes using_oneconnect

 

 

optional ( lan_or_wan == "WAN" ) {

 

noyes reuse_compression_profile

 

optional ( reuse_compression_profile == "Yes" ) {

 

choice select_compression_profile display "xlarge" tcl {

 

tmsh::run_proc f5.app_utils:get_items_local_only_not_recursive /ltm profile http-compression

 

}

 

}

 

}

 

}

 

Below is the implementation code I'm using

 

 

if { $::optimizations__lan_or_wan == $::WAN_OPTION && $::optimizations__reuse_compression_profile == $::YES_ANSWER } {

 

set existing_compression_profile [lindex [lindex [list "$http_optimization_profile_names"] 0] 1]

 

set existing_compression_profile [lsearch -inline [lindex [ list "$http_optimization_profile_names"] 0] *wan* ]

 

set compression_profile $::optimizations__select_compression_profile

 

}

 

 

Then when I build the VS

 

 

if { $::optimizations__lan_or_wan == $::WAN_OPTION && $::optimizations__reuse_compression_profile == $::YES_ANSWER } {

 

tmsh_modify "/ ltm virtual" "$vs_name profiles delete \{ $existing_compression_profile \}"

 

tmsh::delete ltm profile http-compression $tmsh::app_name.app/$existing_compression_profile

 

tmsh_modify "/ ltm virtual" "$vs_name profiles add \{ $compression_profile \}"

 

}

 

 

From the logs in /var/log/audit I can't see the tmsh::delete command being run, so I must be using the incorrect syntax. Anybody got any ideas how I can run tmsh::delete? Will I have to create a proc?

 

Thanks,

 

2 Replies

  • Mitra_Kelly_625's avatar
    Mitra_Kelly_625
    Historic F5 Account
    The delete command fails silently when run from an iApp. So, if you don't have the object name perfect, you will see the command in the log, bug nothing will happen.

     

     

    I noticed that in the code that you presented, you are using a different object name when you remove the profile from the virtual server than you do when you try to delete that profile.

     

     

    tmsh_modify "/ ltm virtual" "$vs_name profiles delete \{ $existing_compression_profile \}"

     

    tmsh::delete ltm profile http-compression $tmsh::app_name.app/$existing_compression_profile

     

     

    I think that, assuming that the modify command with the variable $existing_compression_profile successfully removes the profile from the virtual server, then the command

     

     

    tmsh::delete ltm profile http-compression $existing_compression_profile

     

     

    should succeed in deleting the profile.

     

     

  • Hello Mitra,

     

    I did try to use tmsh::delete command without the full path in the past, just like you suggested. However the profile is not removed. In /var/log/audit I see the following (I've added numbers to the beginning of the lines for better referrencing): [Note: I've set tmsh::log_level to debug at the top of the implementation code]

     

     

    1. Feb 21 20:41:21 pinky notice mcpd[5859]: 01070417:5: AUDIT - user admin - transaction 106949-86 - object 0 - obj_delete { pool_member { pool_member_pool_name "/Common/Testing.app/Testing_blah1_pool" } } [Status=Command OK]

     

    2. Feb 21 20:41:21 pinky notice mcpd[5859]: 01070417:5: AUDIT - user admin - transaction 106949-87 - object 0 - create_if { pool_member { pool_member_pool_name "/Common/Testing.app/Testing_blah1_pool" pool_member_node_name "/Common/12.12.12.12" pool_member_port irdmi pool_member_conn_limit 0 } } [Status=Command OK]

     

    3. Feb 21 20:41:21 pinky notice mcpd[5859]: 01070417:5: AUDIT - user admin - transaction 106949-98 - object 0 - obj_delete { virtual_server_httpclass { virtual_server_httpclass_vs_name "/Common/Testing.app/Testing_blah1_http_virtual" } } [Status=Command OK]

     

    4. Feb 21 20:41:21 pinky notice mcpd[5859]: 01070417:5: AUDIT - user admin - transaction 106949-99 - object 0 - obj_delete { virtual_server_persist { virtual_server_persist_vs_name "/Common/Testing.app/Testing_blah1_http_virtual" } } [Status=Command OK]

     

    5. Feb 21 20:41:21 pinky notice mcpd[5859]: 01070417:5: AUDIT - user admin - transaction 106949-100 - object 0 - create { virtual_server_persist { virtual_server_persist_vs_name "/Common/Testing.app/Testing_blah1_http_virtual" virtual_server_persist_profile_name "/Common/Testing.app/Testing_blah1_cookie_persistence_profile" virtual_server_persist_default 1 } } [Status=Command OK]

     

    6. Feb 21 20:41:21 pinky notice mcpd[5859]: 01070417:5: AUDIT - user admin - transaction 106949-101 - object 0 - obj_delete { virtual_server_profile { virtual_server_profile_vs_name "/Common/Testing.app/Testing_blah1_http_virtual" } } [Status=Command OK]

     

    7. Feb 21 20:41:21 pinky notice mcpd[5859]: 01070417:5: AUDIT - user admin - transaction 106949-102 - object 0 - obj_delete { virtual_server_rule { virtual_server_rule_virtual_server_name "/Common/Testing.app/Testing_blah1_http_virtual" } } [Status=Command OK]

     

    8. Feb 21 20:41:21 pinky notice mcpd[5859]: 01070417:5: AUDIT - user admin - transaction 106949-105 - object 0 - obj_delete { virtual_server_profile { virtual_server_profile_vs_name "/Common/Testing.app/Testing_blah1_http_virtual" } } [Status=Command OK]

     

    9. Feb 21 20:41:21 pinky notice mcpd[5859]: 01070417:5: AUDIT - user admin - transaction 106949-106 - object 0 - create_if { virtual_server_profile { virtual_server_profile_vs_name "/Common/Testing.app/Testing_blah1_http_virtual" virtual_server_profile_profile_name "/Common/Testing.app/Testing_blah1_http_profile" } } [Status=Command OK]

     

    10. Feb 21 20:41:21 pinky notice mcpd[5859]: 01070417:5: AUDIT - user admin - transaction 106949-107 - object 0 - create_if { virtual_server_profile { virtual_server_profile_vs_name "/Common/Testing.app/Testing_blah1_http_virtual" virtual_server_profile_profile_name "/Common/Testing.app/Testing_blah1_wan-optimized-compression_profile" } } [Status=Command OK]

     

    11. Feb 21 20:41:21 pinky notice mcpd[5859]: 01070417:5: AUDIT - user admin - transaction 106949-110 - object 0 - create { virtual_server_profile { virtual_server_profile_vs_name "/Common/Testing.app/Testing_blah1_http_virtual" virtual_server_profile_profile_name "/Common/Testing.app/Testing_blah1_lan-optimized_tcp_profile" virtual_server_profile_profile_context 2 } } [Status=Command OK]

     

    12. Feb 21 20:41:21 pinky notice mcpd[5859]: 01070417:5: AUDIT - user admin - transaction 106949-113 - object 0 - create { virtual_server_profile { virtual_server_profile_vs_name "/Common/Testing.app/Testing_blah1_http_virtual" virtual_server_profile_profile_name "/Common/Testing.app/Testing_blah1_wan-optimized_tcp_profile" virtual_server_profile_profile_context 1 } } [Status=Command OK]

     

    13. Feb 21 20:41:21 pinky notice mcpd[5859]: 01070417:5: AUDIT - user admin - transaction 106949-116 - object 0 - obj_delete { virtual_server_profile { virtual_server_profile_vs_name "/Common/Testing.app/Testing_blah1_http_virtual" virtual_server_profile_profile_name "/Common/Testing.app/Testing_blah1_wan-optimized-compression_profile" } } [Status=Command OK]

     

    14. Feb 21 20:41:21 pinky notice mcpd[5859]: 01070417:5: AUDIT - user admin - transaction 106949-119 - object 0 - create { virtual_server_profile { virtual_server_profile_vs_name "/Common/Testing.app/Testing_blah1_http_virtual" virtual_server_profile_profile_name "/Common/Letsima_Compression" } } [Status=Command OK]

     

    15. Feb 21 20:41:22 pinky notice tmsh[11722]: 01420002:5: AUDIT - pid=11722 user=root folder=/Common module=(tmos) status=[Command OK] cmd_data=save / sys config partitions all

     

     

     

    Lines 10 to 14 shows the creation of the profile (Testing_blah1_wan-optimized-compression_profile) and the modification to remove the profile from the VS but no where does it show tmsh::delete being run. The profile object is deleted from the VS on line 13.

     

     

     

     

    I've also tried...

     

     

    tmsh::delete / ltm profile http-compression /Common/$tmsh::app_name.app/$existing_compression_accel_profile

     

    and

     

    tmsh::delete / ltm profile http-compression /Common/Testing.app/$existing_compression_accel_profile

     

     

    with also no success. It appears from the logs that the tmsh::delete command is never fired or 'overlooked' :(