New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iis_pool config doesn't reset runtime version to No Managed Code #217

Closed
DivineOps opened this Issue Oct 22, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@DivineOps

DivineOps commented Oct 22, 2015

When I add a new app pool using

iis_pool 'my_pool' do
    action [:add, :config, :start]
    no_managed_code true
end

Leaving the runtime_version empty and setting no_managed_code true then the new pool runtime version is set to No Managed Code
However if the pool exists :config DOES NOT change the existing runtime version to No Managed Code

Also, the no_managed_code default is set to false in the provider, but the cookbook description says the default is true.

@EasyAsABC123

This comment has been minimized.

Show comment
Hide comment
@EasyAsABC123

EasyAsABC123 Oct 22, 2015

Collaborator

In add it is:

    if new_resource.no_managed_code
      cmd << " /managedRuntimeVersion:\"#{new_resource.runtime_version}\""
    else
      cmd << " /managedRuntimeVersion:v#{new_resource.runtime_version}" if new_resource.runtime_version
    end

In config it is:

    if new_resource.no_managed_code
      configure_application_pool(new_resource.runtime_version && is_new_managed_runtime_version, "managedRuntimeVersion:#{new_resource.runtime_version}")
    else
      configure_application_pool(new_resource.runtime_version && is_new_managed_runtime_version, "managedRuntimeVersion:v#{new_resource.runtime_version}")
    end

configure_application_pool function declaration:

def configure_application_pool(condition, config, add_remove = '')
  return unless condition

  @was_updated = true
  @cmd << " \"/#{add_remove}[name='#{new_resource.pool_name}'].#{config}\""
end

So the default of runtime_version is nothing:

attribute :runtime_version, kind_of: String

So the issue appears to be in the logic in config because it is looking for is_new_managed_runtime_version

is_new_managed_runtime_version = new_value?(doc.root, 'APPPOOL/@RuntimeVersion', "v#{new_resource.runtime_version}")

this is a very complex solution for something that honestly isn't as complex as i've made it.

Thanks for pointing this out to me again

Collaborator

EasyAsABC123 commented Oct 22, 2015

In add it is:

    if new_resource.no_managed_code
      cmd << " /managedRuntimeVersion:\"#{new_resource.runtime_version}\""
    else
      cmd << " /managedRuntimeVersion:v#{new_resource.runtime_version}" if new_resource.runtime_version
    end

In config it is:

    if new_resource.no_managed_code
      configure_application_pool(new_resource.runtime_version && is_new_managed_runtime_version, "managedRuntimeVersion:#{new_resource.runtime_version}")
    else
      configure_application_pool(new_resource.runtime_version && is_new_managed_runtime_version, "managedRuntimeVersion:v#{new_resource.runtime_version}")
    end

configure_application_pool function declaration:

def configure_application_pool(condition, config, add_remove = '')
  return unless condition

  @was_updated = true
  @cmd << " \"/#{add_remove}[name='#{new_resource.pool_name}'].#{config}\""
end

So the default of runtime_version is nothing:

attribute :runtime_version, kind_of: String

So the issue appears to be in the logic in config because it is looking for is_new_managed_runtime_version

is_new_managed_runtime_version = new_value?(doc.root, 'APPPOOL/@RuntimeVersion', "v#{new_resource.runtime_version}")

this is a very complex solution for something that honestly isn't as complex as i've made it.

Thanks for pointing this out to me again

@EasyAsABC123

This comment has been minimized.

Show comment
Hide comment
@EasyAsABC123

EasyAsABC123 Oct 29, 2015

Collaborator

fixed: a299aa0

Collaborator

EasyAsABC123 commented Oct 29, 2015

fixed: a299aa0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment