Skip to content

Commit

Permalink
Merge branch 'main' into RESOURCE-540-remove-frozen-string-literal-fr…
Browse files Browse the repository at this point in the history
…om-inspec-azure
  • Loading branch information
soumyo13 authored Dec 5, 2022
2 parents b2fccee + 7bfadcc commit ef9bd21
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# Changelog
<!-- latest_release 1.118.26 -->
<!-- latest_release 1.118.27 -->
## [v1.118.27](https://github.com/inspec/inspec-azure/tree/v1.118.27) (2022-11-29)

#### Merged Pull Requests
- RESOURCE-537 add-attribute-for-stack-version-for-webapp [#701](https://github.com/inspec/inspec-azure/pull/701) ([sa-progress](https://github.com/sa-progress))
<!-- latest_release -->

## [v1.118.26](https://github.com/inspec/inspec-azure/tree/v1.118.26) (2022-11-24)

#### Merged Pull Requests
- RESOURCE-538 Fix config cache and also fixed the lint errors [#699](https://github.com/inspec/inspec-azure/pull/699) ([sathish-progress](https://github.com/sathish-progress))
<!-- latest_release -->

## [v1.118.25](https://github.com/inspec/inspec-azure/tree/v1.118.25) (2022-11-22)

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.118.26
1.118.27
2 changes: 1 addition & 1 deletion inspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ copyright: Chef Software, Inc.
copyright_email: support@chef.io
license: Apache-2.0
summary: This resource pack provides compliance resources for Azure.
version: 1.118.26
version: 1.118.27
inspec_version: '>= 4.18.39'
supports:
- platform: azure
32 changes: 28 additions & 4 deletions libraries/azure_webapp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,17 @@ def using_latest?(stack)
def stack_version(stack)
stack = 'netFramework' if stack.eql?('aspnet')
stack_key = "#{stack}Version"
raise ArgumentError, "#{stack} is not a supported stack." unless configuration.properties.respond_to?(stack_key)
raise ArgumentError, "#{stack} is not a supported stack." unless stack_supported(stack)
linux_fx_version = configuration.properties.public_send('linuxFxVersion')

if !linux_fx_version.empty?
existing_stack = linux_fx_version.split('|')[0]
existing_stack = existing_stack.downcase
new_stack = stack.downcase
version = linux_fx_version.split('|')[1] if existing_stack.eql?(new_stack)
version = linux_fx_version.split('|')[1] if get_language(existing_stack).eql?(get_language(new_stack))
else
version = configuration.properties.public_send(stack_key.to_s)
end
version.nil? || version.empty? ? nil : version
version.nil? || version.empty? ? nil : parse_version(version)
end

def latest(stack)
Expand All @@ -113,6 +112,31 @@ def latest(stack)
latest_supported[0] = '' if latest_supported[0].casecmp?('v')
latest_supported
end

private

def parse_version(version)
is_java_version = !(version =~ /java/ || version =~/jre/).nil?
return version unless is_java_version
version.split('-')[1].gsub(/java|jre|/, '')
end

def get_language(stack)
lang_hash = { python: 'python', php: 'php', tomcat: 'tomcat', java: 'tomcat' }
lang_hash[:"#{stack}"]
end

def stack_supported(stack)
return false unless configuration.properties.respond_to?("#{stack}Version") || configuration.properties.public_send("#{stack}Version").nil?
# Below commented code for custom stack identification for furture requirements.
# linux_fx_version = configuration.properties.public_send('linuxFxVersion')
# if !linux_fx_version.nil? && !linux_fx_version.empty?
# stack = get_language(stack.downcase)
# existing_stack = linux_fx_version.split('|')[0]
# return get_language(existing_stack.downcase).casecmp(stack) == 0
# end
true
end
end

# Provide the same functionality under the old resource name.
Expand Down
5 changes: 5 additions & 0 deletions terraform/azure.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1692,13 +1692,18 @@ resource "azurerm_synapse_workspace" "synapse_inspec_ws" {
storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.inspec_adls_gen2.id
sql_administrator_login = "sqladminuser"
sql_administrator_login_password = "H@Sh1CoR3!"
public_network_access_enabled = false

aad_admin {
login = "AzureAD Admin"
object_id = "00000000-0000-0000-0000-000000000000"
tenant_id = "00000000-0000-0000-0000-000000000000"
}

identity {
type = "SystemAssigned"
}

tags = {
Env = "inspec"
}
Expand Down

0 comments on commit ef9bd21

Please sign in to comment.