Skip to content

Commit

Permalink
Convert tool parse_application_properties to python3
Browse files Browse the repository at this point in the history
  • Loading branch information
mbloch1986 committed Jul 13, 2023
1 parent b0c7d04 commit 874c852
Show file tree
Hide file tree
Showing 5 changed files with 213 additions and 152 deletions.
68 changes: 34 additions & 34 deletions manifests/application_properties.pp
Expand Up @@ -7,7 +7,7 @@
# `application.properties` from which it is generated. (see below)
#
# _Note:_ This is an internal class that shouldn't be used directly. It is
# included by the `aem_orchestrator` class. You can change values for it's
# included by the `aem_orchestrator` class. You can change values for its
# parameters using Hiera.
#
# @see https://github.com/shinesolutions/aem-orchestrator/blob/master/src/main/resources/application.properties
Expand Down Expand Up @@ -63,36 +63,36 @@
# @param aem_port_author_dispatcher
# Java property `aem.port.authorDispatcher`
#
# @param aem_port_publish
# Java property `aem.port.publish`
#
# @param aem_port_publish_dispatcher
# Java property `aem.port.publishDispatcher`
#
# @param aem_port_preview_publish
# Java property `aem.port.previewPublish`
#
# @param aem_port_preview_publish_dispatcher
# Java property `aem.port.previewPublishDispatcher`
#
# @param aem_port_publish
# Java property `aem.port.publish`
#
# @param aem_port_publish_dispatcher
# Java property `aem.port.publishDispatcher`
#
# @param aem_protocol_author
# Java property `aem.protocol.author`
#
# @param aem_protocol_author_dispatcher
# Java property `aem.protocol.authorDispatcher`
#
# @param aem_protocol_publish
# Java property `aem.protocol.publish`
#
# @param aem_protocol_publish_dispatcher
# Java property `aem.protocol.publishDispatcher`
#
# @param aem_protocol_preview_publish
# Java property `aem.protocol.previewPublish`
#
# @param aem_protocol_preview_publish_dispatcher
# Java property `aem.protocol.previewPublishDispatcher`
#
# @param aem_protocol_publish
# Java property `aem.protocol.publish`
#
# @param aem_protocol_publish_dispatcher
# Java property `aem.protocol.publishDispatcher`
#
# @param aem_relaxed_ssl_enable
# Java property `aem.relaxed.ssl.enable`
#
Expand Down Expand Up @@ -132,18 +132,18 @@
# @param aws_cloudformation_auto_scale_group_logical_id_author_dispatcher
# Java property `aws.cloudformation.autoScaleGroup.logicalId.authorDispatcher`
#
# @param aws_cloudformation_auto_scale_group_logical_id_publish
# Java property `aws.cloudformation.autoScaleGroup.logicalId.publish`
#
# @param aws_cloudformation_auto_scale_group_logical_id_publish_dispatcher
# Java property `aws.cloudformation.autoScaleGroup.logicalId.publishDispatcher`
#
# @param aws_cloudformation_auto_scale_group_logical_id_preview_publish
# Java property `aws.cloudformation.autoScaleGroup.logicalId.previewPublish`
#
# @param aws_cloudformation_auto_scale_group_logical_id_preview_publish_dispatcher
# Java property `aws.cloudformation.autoScaleGroup.logicalId.previewPublishDispatcher`
#
# @param aws_cloudformation_auto_scale_group_logical_id_publish
# Java property `aws.cloudformation.autoScaleGroup.logicalId.publish`
#
# @param aws_cloudformation_auto_scale_group_logical_id_publish_dispatcher
# Java property `aws.cloudformation.autoScaleGroup.logicalId.publishDispatcher`
#
# @param aws_cloudformation_load_balancer_logical_id_author
# Java property `aws.cloudformation.loadBalancer.logicalId.author`
#
Expand All @@ -159,18 +159,18 @@
# @param aws_cloudformation_stack_name_messaging
# Java property `aws.cloudformation.stackName.messaging`
#
# @param aws_cloudformation_stack_name_publish
# Java property `aws.cloudformation.stackName.publish`
#
# @param aws_cloudformation_stack_name_publish_dispatcher
# Java property `aws.cloudformation.stackName.publishDispatcher`
#
# @param aws_cloudformation_stack_name_preview_publish
# Java property `aws.cloudformation.stackName.previewPublish`
#
# @param aws_cloudformation_stack_name_preview_publish_dispatcher
# Java property `aws.cloudformation.stackName.previewPublishDispatcher`
#
# @param aws_cloudformation_stack_name_publish
# Java property `aws.cloudformation.stackName.publish`
#
# @param aws_cloudformation_stack_name_publish_dispatcher
# Java property `aws.cloudformation.stackName.publishDispatcher`
#
# @param aws_device_name
# Java property `aws.device.name`
#
Expand Down Expand Up @@ -228,16 +228,16 @@
Variant[String, Undef] $aem_flush_log_level = undef,
Variant[String, Undef] $aem_port_author = undef,
Variant[String, Undef] $aem_port_author_dispatcher = undef,
Variant[String, Undef] $aem_port_publish = undef,
Variant[String, Undef] $aem_port_publish_dispatcher = undef,
Variant[String, Undef] $aem_port_preview_publish = undef,
Variant[String, Undef] $aem_port_preview_publish_dispatcher = undef,
Variant[String, Undef] $aem_port_publish = undef,
Variant[String, Undef] $aem_port_publish_dispatcher = undef,
Variant[String, Undef] $aem_protocol_author = undef,
Variant[String, Undef] $aem_protocol_author_dispatcher = undef,
Variant[String, Undef] $aem_protocol_publish = undef,
Variant[String, Undef] $aem_protocol_publish_dispatcher = undef,
Variant[String, Undef] $aem_protocol_preview_publish = undef,
Variant[String, Undef] $aem_protocol_preview_publish_dispatcher = undef,
Variant[String, Undef] $aem_protocol_publish = undef,
Variant[String, Undef] $aem_protocol_publish_dispatcher = undef,
Variant[String, Undef] $aem_relaxed_ssl_enable = undef,
Variant[String, Undef] $aem_replication_log_level = undef,
Variant[String, Undef] $aem_reverse_replication_enable = undef,
Expand All @@ -251,19 +251,19 @@
Variant[String, Undef] $aws_client_proxy_port = undef,
Variant[String, Undef] $aws_client_use_proxy = undef,
Variant[String, Undef] $aws_cloudformation_auto_scale_group_logical_id_author_dispatcher = undef,
Variant[String, Undef] $aws_cloudformation_auto_scale_group_logical_id_publish = undef,
Variant[String, Undef] $aws_cloudformation_auto_scale_group_logical_id_publish_dispatcher = undef,
Variant[String, Undef] $aws_cloudformation_auto_scale_group_logical_id_preview_publish = undef,
Variant[String, Undef] $aws_cloudformation_auto_scale_group_logical_id_preview_publish_dispatcher = undef,
Variant[String, Undef] $aws_cloudformation_auto_scale_group_logical_id_publish = undef,
Variant[String, Undef] $aws_cloudformation_auto_scale_group_logical_id_publish_dispatcher = undef,
Variant[String, Undef] $aws_cloudformation_load_balancer_logical_id_author = undef,
Variant[String, Undef] $aws_cloudformation_sns_logical_id_event_topic = undef,
Variant[String, Undef] $aws_cloudformation_stack_name_author = undef,
Variant[String, Undef] $aws_cloudformation_stack_name_author_dispatcher = undef,
Variant[String, Undef] $aws_cloudformation_stack_name_messaging = undef,
Variant[String, Undef] $aws_cloudformation_stack_name_publish = undef,
Variant[String, Undef] $aws_cloudformation_stack_name_publish_dispatcher = undef,
Variant[String, Undef] $aws_cloudformation_stack_name_preview_publish = undef,
Variant[String, Undef] $aws_cloudformation_stack_name_preview_publish_dispatcher = undef,
Variant[String, Undef] $aws_cloudformation_stack_name_publish = undef,
Variant[String, Undef] $aws_cloudformation_stack_name_publish_dispatcher = undef,
Variant[String, Undef] $aws_device_name = undef,
Variant[String, Undef] $aws_region = undef,
Variant[String, Undef] $aws_snapshot_tags = undef,
Expand All @@ -276,7 +276,6 @@
Variant[String, Undef] $startup_wait_for_author_elb_back_off_period_multiplier = undef,
Variant[String, Undef] $startup_wait_for_author_elb_max_attempts = undef,
Variant[String, Undef] $startup_wait_for_author_elb_max_back_off_period = undef,

) {
file { $path:
ensure => file,
Expand All @@ -286,3 +285,4 @@
content => template('aem_orchestrator/application_properties.erb'),
}
}

1 change: 1 addition & 0 deletions requirements.txt
@@ -1,3 +1,4 @@
case_conversion==2.1.0
javaproperties==0.5.2
jinja2==2.10.1
more-itertools==8.14.0
35 changes: 34 additions & 1 deletion spec/classes/application_properties_spec.rb
Expand Up @@ -51,6 +51,14 @@
let(:params) { {:aem_port_author_dispatcher => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aem.port.authorDispatcher = foo/) }
end
context 'with aem_port_preview_publish => foo' do
let(:params) { {:aem_port_preview_publish => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aem.port.previewPublish = foo/) }
end
context 'with aem_port_preview_publish_dispatcher => foo' do
let(:params) { {:aem_port_preview_publish_dispatcher => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aem.port.previewPublishDispatcher = foo/) }
end
context 'with aem_port_publish => foo' do
let(:params) { {:aem_port_publish => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aem.port.publish = foo/) }
Expand All @@ -67,6 +75,14 @@
let(:params) { {:aem_protocol_author_dispatcher => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aem.protocol.authorDispatcher = foo/) }
end
context 'with aem_protocol_preview_publish => foo' do
let(:params) { {:aem_protocol_preview_publish => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aem.protocol.previewPublish = foo/) }
end
context 'with aem_protocol_preview_publish_dispatcher => foo' do
let(:params) { {:aem_protocol_preview_publish_dispatcher => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aem.protocol.previewPublishDispatcher = foo/) }
end
context 'with aem_protocol_publish => foo' do
let(:params) { {:aem_protocol_publish => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aem.protocol.publish = foo/) }
Expand Down Expand Up @@ -127,6 +143,14 @@
let(:params) { {:aws_cloudformation_auto_scale_group_logical_id_author_dispatcher => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aws.cloudformation.autoScaleGroup.logicalId.authorDispatcher = foo/) }
end
context 'with aws_cloudformation_auto_scale_group_logical_id_preview_publish => foo' do
let(:params) { {:aws_cloudformation_auto_scale_group_logical_id_preview_publish => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aws.cloudformation.autoScaleGroup.logicalId.previewPublish = foo/) }
end
context 'with aws_cloudformation_auto_scale_group_logical_id_preview_publish_dispatcher => foo' do
let(:params) { {:aws_cloudformation_auto_scale_group_logical_id_preview_publish_dispatcher => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aws.cloudformation.autoScaleGroup.logicalId.previewPublishDispatcher = foo/) }
end
context 'with aws_cloudformation_auto_scale_group_logical_id_publish => foo' do
let(:params) { {:aws_cloudformation_auto_scale_group_logical_id_publish => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aws.cloudformation.autoScaleGroup.logicalId.publish = foo/) }
Expand Down Expand Up @@ -155,6 +179,14 @@
let(:params) { {:aws_cloudformation_stack_name_messaging => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aws.cloudformation.stackName.messaging = foo/) }
end
context 'with aws_cloudformation_stack_name_preview_publish => foo' do
let(:params) { {:aws_cloudformation_stack_name_preview_publish => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aws.cloudformation.stackName.previewPublish = foo/) }
end
context 'with aws_cloudformation_stack_name_preview_publish_dispatcher => foo' do
let(:params) { {:aws_cloudformation_stack_name_preview_publish_dispatcher => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aws.cloudformation.stackName.previewPublishDispatcher = foo/) }
end
context 'with aws_cloudformation_stack_name_publish => foo' do
let(:params) { {:aws_cloudformation_stack_name_publish => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^aws.cloudformation.stackName.publish = foo/) }
Expand Down Expand Up @@ -211,4 +243,5 @@
let(:params) { {:startup_wait_for_author_elb_max_back_off_period => 'foo', :path => '/tmp/foo', } }
it { is_expected.to contain_file('/tmp/foo').with_content(/^startup.waitForAuthorElb.maxBackOffPeriod = foo/) }
end
end
end

49 changes: 25 additions & 24 deletions templates/application_properties.erb
Expand Up @@ -35,36 +35,36 @@
<%- if scope[pfx + 'aem_port_author_dispatcher'] != nil -%>
<%--%>aem.port.authorDispatcher = <%= scope[pfx + 'aem_port_author_dispatcher'] %>
<%- end -%>
<%- if scope[pfx + 'aem_port_publish'] != nil -%>
<%--%>aem.port.publish = <%= scope[pfx + 'aem_port_publish'] %>
<%- end -%>
<%- if scope[pfx + 'aem_port_publish_dispatcher'] != nil -%>
<%--%>aem.port.publishDispatcher = <%= scope[pfx + 'aem_port_publish_dispatcher'] %>
<%- end -%>
<%- if scope[pfx + 'aem_port_preview_publish'] != nil -%>
<%--%>aem.port.previewPublish = <%= scope[pfx + 'aem_port_preview_publish'] %>
<%- end -%>
<%- if scope[pfx + 'aem_port_preview_publish_dispatcher'] != nil -%>
<%--%>aem.port.previewPublishDispatcher = <%= scope[pfx + 'aem_port_preview_publish_dispatcher'] %>
<%- end -%>
<%- if scope[pfx + 'aem_port_publish'] != nil -%>
<%--%>aem.port.publish = <%= scope[pfx + 'aem_port_publish'] %>
<%- end -%>
<%- if scope[pfx + 'aem_port_publish_dispatcher'] != nil -%>
<%--%>aem.port.publishDispatcher = <%= scope[pfx + 'aem_port_publish_dispatcher'] %>
<%- end -%>
<%- if scope[pfx + 'aem_protocol_author'] != nil -%>
<%--%>aem.protocol.author = <%= scope[pfx + 'aem_protocol_author'] %>
<%- end -%>
<%- if scope[pfx + 'aem_protocol_author_dispatcher'] != nil -%>
<%--%>aem.protocol.authorDispatcher = <%= scope[pfx + 'aem_protocol_author_dispatcher'] %>
<%- end -%>
<%- if scope[pfx + 'aem_protocol_publish'] != nil -%>
<%--%>aem.protocol.publish = <%= scope[pfx + 'aem_protocol_publish'] %>
<%- end -%>
<%- if scope[pfx + 'aem_protocol_publish_dispatcher'] != nil -%>
<%--%>aem.protocol.publishDispatcher = <%= scope[pfx + 'aem_protocol_publish_dispatcher'] %>
<%- end -%>
<%- if scope[pfx + 'aem_protocol_preview_publish'] != nil -%>
<%--%>aem.protocol.previewPublish = <%= scope[pfx + 'aem_protocol_preview_publish'] %>
<%- end -%>
<%- if scope[pfx + 'aem_protocol_preview_publish_dispatcher'] != nil -%>
<%--%>aem.protocol.previewPublishDispatcher = <%= scope[pfx + 'aem_protocol_preview_publish_dispatcher'] %>
<%- end -%>
<%- if scope[pfx + 'aem_protocol_publish'] != nil -%>
<%--%>aem.protocol.publish = <%= scope[pfx + 'aem_protocol_publish'] %>
<%- end -%>
<%- if scope[pfx + 'aem_protocol_publish_dispatcher'] != nil -%>
<%--%>aem.protocol.publishDispatcher = <%= scope[pfx + 'aem_protocol_publish_dispatcher'] %>
<%- end -%>
<%- if scope[pfx + 'aem_relaxed_ssl_enable'] != nil -%>
<%--%>aem.relaxed.ssl.enable = <%= scope[pfx + 'aem_relaxed_ssl_enable'] %>
<%- end -%>
Expand Down Expand Up @@ -104,18 +104,18 @@
<%- if scope[pfx + 'aws_cloudformation_auto_scale_group_logical_id_author_dispatcher'] != nil -%>
<%--%>aws.cloudformation.autoScaleGroup.logicalId.authorDispatcher = <%= scope[pfx + 'aws_cloudformation_auto_scale_group_logical_id_author_dispatcher'] %>
<%- end -%>
<%- if scope[pfx + 'aws_cloudformation_auto_scale_group_logical_id_publish'] != nil -%>
<%--%>aws.cloudformation.autoScaleGroup.logicalId.publish = <%= scope[pfx + 'aws_cloudformation_auto_scale_group_logical_id_publish'] %>
<%- end -%>
<%- if scope[pfx + 'aws_cloudformation_auto_scale_group_logical_id_publish_dispatcher'] != nil -%>
<%--%>aws.cloudformation.autoScaleGroup.logicalId.publishDispatcher = <%= scope[pfx + 'aws_cloudformation_auto_scale_group_logical_id_publish_dispatcher'] %>
<%- end -%>
<%- if scope[pfx + 'aws_cloudformation_auto_scale_group_logical_id_preview_publish'] != nil -%>
<%--%>aws.cloudformation.autoScaleGroup.logicalId.previewPublish = <%= scope[pfx + 'aws_cloudformation_auto_scale_group_logical_id_preview_publish'] %>
<%- end -%>
<%- if scope[pfx + 'aws_cloudformation_auto_scale_group_logical_id_preview_publish_dispatcher'] != nil -%>
<%--%>aws.cloudformation.autoScaleGroup.logicalId.previewPublishDispatcher = <%= scope[pfx + 'aws_cloudformation_auto_scale_group_logical_id_preview_publish_dispatcher'] %>
<%- end -%>
<%- if scope[pfx + 'aws_cloudformation_auto_scale_group_logical_id_publish'] != nil -%>
<%--%>aws.cloudformation.autoScaleGroup.logicalId.publish = <%= scope[pfx + 'aws_cloudformation_auto_scale_group_logical_id_publish'] %>
<%- end -%>
<%- if scope[pfx + 'aws_cloudformation_auto_scale_group_logical_id_publish_dispatcher'] != nil -%>
<%--%>aws.cloudformation.autoScaleGroup.logicalId.publishDispatcher = <%= scope[pfx + 'aws_cloudformation_auto_scale_group_logical_id_publish_dispatcher'] %>
<%- end -%>
<%- if scope[pfx + 'aws_cloudformation_load_balancer_logical_id_author'] != nil -%>
<%--%>aws.cloudformation.loadBalancer.logicalId.author = <%= scope[pfx + 'aws_cloudformation_load_balancer_logical_id_author'] %>
<%- end -%>
Expand All @@ -131,18 +131,18 @@
<%- if scope[pfx + 'aws_cloudformation_stack_name_messaging'] != nil -%>
<%--%>aws.cloudformation.stackName.messaging = <%= scope[pfx + 'aws_cloudformation_stack_name_messaging'] %>
<%- end -%>
<%- if scope[pfx + 'aws_cloudformation_stack_name_publish'] != nil -%>
<%--%>aws.cloudformation.stackName.publish = <%= scope[pfx + 'aws_cloudformation_stack_name_publish'] %>
<%- end -%>
<%- if scope[pfx + 'aws_cloudformation_stack_name_publish_dispatcher'] != nil -%>
<%--%>aws.cloudformation.stackName.publishDispatcher = <%= scope[pfx + 'aws_cloudformation_stack_name_publish_dispatcher'] %>
<%- end -%>
<%- if scope[pfx + 'aws_cloudformation_stack_name_preview_publish'] != nil -%>
<%--%>aws.cloudformation.stackName.previewPublish = <%= scope[pfx + 'aws_cloudformation_stack_name_preview_publish'] %>
<%- end -%>
<%- if scope[pfx + 'aws_cloudformation_stack_name_preview_publish_dispatcher'] != nil -%>
<%--%>aws.cloudformation.stackName.previewPublishDispatcher = <%= scope[pfx + 'aws_cloudformation_stack_name_preview_publish_dispatcher'] %>
<%- end -%>
<%- if scope[pfx + 'aws_cloudformation_stack_name_publish'] != nil -%>
<%--%>aws.cloudformation.stackName.publish = <%= scope[pfx + 'aws_cloudformation_stack_name_publish'] %>
<%- end -%>
<%- if scope[pfx + 'aws_cloudformation_stack_name_publish_dispatcher'] != nil -%>
<%--%>aws.cloudformation.stackName.publishDispatcher = <%= scope[pfx + 'aws_cloudformation_stack_name_publish_dispatcher'] %>
<%- end -%>
<%- if scope[pfx + 'aws_device_name'] != nil -%>
<%--%>aws.device.name = <%= scope[pfx + 'aws_device_name'] %>
<%- end -%>
Expand Down Expand Up @@ -179,3 +179,4 @@
<%- if scope[pfx + 'startup_wait_for_author_elb_max_back_off_period'] != nil -%>
<%--%>startup.waitForAuthorElb.maxBackOffPeriod = <%= scope[pfx + 'startup_wait_for_author_elb_max_back_off_period'] %>
<%- end -%>

0 comments on commit 874c852

Please sign in to comment.