~ibmcharmers/trusty/ibm-was-nd-node

Owner: geethas1
Status: Needs Fixing
Vote: -1 (+2 needed for approval)

CPP?: No
OIL?: No

Hello Team,

Here is a new charm for IBM WAS ND Node for review.

To test the IBM WAS ND Node, we need the IBM WAS ND charm as well. As per the design changes, the WAS ND charm has been split into three charms:
IBM WAS ND
IBM WAS ND DM
IBM WAS ND Node.

We need all three charms to be tested to have a WAS ND dynamic cluster. Here we are using IBM WAS ND charm as a common layer for IBM WAS ND DM and IBM WAS ND Node charms.

Deployable ibm-ibm-was-nd-node layer charm can be found in the below repository.
Repo : https://code.launchpad.net/~ibmcharmers/charms/trusty/ibm-was-nd-node/trunk

And, its source code can be found in the below repository
Repo : https://code.launchpad.net/~ibmcharmers/charms/trusty/layer-ibm-was-nd-node/trunk

The charm has been pushed into charm store as well
branch : cs:~ibmcharmers/trusty/ibm-was-nd-node-7


Tests

Substrate Status Results Last Updated
lxc RETRY 19 days ago
gce RETRY 19 days ago
aws RETRY 19 days ago

Voted: -1
petevg wrote 3 months ago
Hi,

Thank you for your work on this charm!

Unfortunately, I was not able to run the tests locally, as the README references version 9.0 of the WAS ND files, but it looks like the 8.5.5 files are the only ones in the WAS ND brickftp folder. Please share those files, and I will take another look at the tests.

Based on a code read-through, it looks like there are a couple of small issues that I would like to see fixed before I would be comfortable recommending this charm:

1) Idempotent hooks: The set_node_host_name routine ignores failures in relation_call. There should be no failures in that routine, but if there were failures, it would be better to simply fail, and try to run the event again later. As written, if the call fails, the event will never re-run, and the problem will never be fixed.
2) Idempotent hooks: Similarly, in add_was_nd_node, there are several '|| true' statements that prevent the even from simply failing and re-running later if there are failures.
3) Security best practices: remove_from_cluster logs a password to the juju debug log. It is not a best practice to log passwords!

Thank you again for you work on the charm, and I look forward to taking another look once the above issues are addressed.

Add Comment

Login to comment/vote on this review.


Policy Checklist

Description Unreviewed Pass Fail

General

Must verify that any software installed or utilized is verified as coming from the intended source. kos.tsakalozos
  • Any software installed from the Ubuntu or CentOS default archives satisfies this due to the apt and yum sources including cryptographic signing information.
  • Third party repositories must be listed as a configuration option that can be overridden by the user and not hard coded in the charm itself.
  • Launchpad PPAs are acceptable as the add-apt-repository command retrieves the keys securely.
  • Other third party repositories are acceptable if the signing key is embedded in the charm.
Must provide a means to protect users from known security vulnerabilities in a way consistent with best practices as defined by either operating system policies or upstream documentation. kos.tsakalozos
Basically, this means there must be instructions on how to apply updates if you use software not from distribution channels.
Must have hooks that are idempotent. kos.tsakalozos
Should be built using charm layers. kos.tsakalozos
Should use Juju Resources to deliver required payloads. kos.tsakalozos

Testing and Quality

charm proof must pass without errors or warnings. kos.tsakalozos
Must include passing unit, functional, or integration tests. kos.tsakalozos
Tests must exercise all relations. kos.tsakalozos
Tests must exercise config. kos.tsakalozos
set-config, unset-config, and re-set must be tested as a minimum
Must not use anything infrastructure-provider specific (i.e. querying EC2 metadata service). kos.tsakalozos
Must be self contained unless the charm is a proxy for an existing cloud service, e.g. ec2-elb charm.
Must not use symlinks. kos.tsakalozos
Bundles must only use promulgated charms, they cannot reference charms in personal namespaces. kos.tsakalozos
Must call Juju hook tools (relation-*, unit-*, config-*, etc) without a hard coded path. kos.tsakalozos
Should include a tests.yaml for all integration tests. kos.tsakalozos

Metadata

Must include a full description of what the software does. kos.tsakalozos
Must include a maintainer email address for a team or individual who will be responsive to contact. kos.tsakalozos
Must include a license. Call the file 'copyright' and make sure all files' licenses are specified clearly. kos.tsakalozos
Must be under a Free license. kos.tsakalozos
Must have a well documented and valid README.md. kos.tsakalozos
Must describe the service. kos.tsakalozos
Must describe how it interacts with other services, if applicable. kos.tsakalozos
Must document the interfaces. kos.tsakalozos
Must show how to deploy the charm. kos.tsakalozos
Must define external dependencies, if applicable. kos.tsakalozos
Should link to a recommend production usage bundle and recommended configuration if this differs from the default.
Should reference and link to upstream documentation and best practices.

Security

Must not run any network services using default passwords. kos.tsakalozos
Must verify and validate any external payload kos.tsakalozos
  • Known and understood packaging systems that verify packages like apt, pip, and yum are ok.
  • wget | sh style is not ok.
Should make use of whatever Mandatory Access Control system is provided by the distribution. kos.tsakalozos
Should avoid running services as root.

All changes | Changes since last revision

Source Diff

Inline diff comments 0

No comments yet.

Back to file index

Makefile

 1
--- 
 2
+++ Makefile
 3
@@ -0,0 +1,24 @@
 4
+#!/usr/bin/make
 5
+
 6
+all: lint unit_test
 7
+
 8
+
 9
+.PHONY: clean
10
+clean:
11
+	@rm -rf .tox
12
+
13
+.PHONY: apt_prereqs
14
+apt_prereqs:
15
+	@# Need tox, but don't install the apt version unless we have to (don't want to conflict with pip)
16
+	@which tox >/dev/null || (sudo apt-get install -y python-pip && sudo pip install tox)
17
+
18
+.PHONY: lint
19
+lint: apt_prereqs
20
+	@tox --notest
21
+	@PATH=.tox/py34/bin:.tox/py35/bin flake8 $(wildcard hooks reactive lib unit_tests tests)
22
+	@charm proof
23
+
24
+.PHONY: unit_test
25
+unit_test: apt_prereqs
26
+	@echo Starting tests...
27
+	tox
Back to file index

README.md

  1
--- 
  2
+++ README.md
  3
@@ -0,0 +1,159 @@
  4
+Charm for IBM WebSphere Application Server ND Node (WAS ND Node) 8.5.5.0
  5
+
  6
+## Overview
  7
+
  8
+IBM WebSphere Application Server Network Deployment provides an advanced, flexible runtime environment for large-scale application deployments. It offers near-continuous availability with advanced performance and management capabilities for mission-critical applications. For details on IBM Websphere Application Server Network Deployment,  as well as information on purchasing, please visit [Product Page][WAS-ND-product-page] and at the [Passport Advantage Site] [Passport-Advantage]. More information available at the [IBM Knowledge Center] [WAS-ND-Infocenter].
  9
+
 10
+`IBM WebSphere Application Server ND Node`
 11
+
 12
+This charm is using IBM WAS ND charm as a basic layer to install IBM WAS ND Software. After WAS ND installation, this charm will create custom profiles (cluster members) to configure dynamic cluster setup.
 13
+
 14
+**Please note that the WAS ND charms (WAS ND, WAS ND DM and WAS ND Node) will create IBM WAS ND dynamic cluster.
 15
+
 16
+## Prerequisites
 17
+
 18
+This charm makes use of resources, a feature only available in Juju 2.0. During deploy or upgrade, you will need to specify the installable package(s) required by this charm. Download your licensed IBM WebSphere Application Server ND packages from the [Product Page][WAS-ND-8.5.5.0-download].
 19
+
 20
+### Packages for Ubuntu on AMD64 (x86_64):
 21
+
 22
+IBM Installation Manager 1.8 (`agent.installer.linux.gtk.x86_64_1.8.3000.20150606_0047.zip`)
 23
+
 24
+IBM WAS ND 8.5.5 part1 (WASND_v8.5.5_1of3.zip)
 25
+
 26
+IBM WAS ND 8.5.5 part2 (WASND_v8.5.5_2of3.zip)
 27
+
 28
+IBM WAS ND 8.5.5 part3 (WASND_v8.5.5_3of3.zip)
 29
+
 30
+### Packages for Ubuntu on Power (ppc64le):
 31
+
 32
+IBM Installation Manager 1.8 (`agent.installer.linux.gtk.ppc64le_1.8.3000.20150606_0047.zip`)
 33
+
 34
+IBM WAS ND 8.5.5 part1 (WAS_ND_V8.5.5_FOR_POWERLE_ML.zip)
 35
+
 36
+IBM WAS ND 8.5.5 part2 (WASND_V8.5.5_2OF_2_FOR_POWERLE_ML.zip)
 37
+
 38
+## Usage
 39
+
 40
+To use this charm, you must agree to the Terms of Use. You can view the full license for `IBM Installation Manager` and `IBM WebSphere Application Server Network Deployment` products by visiting the [im-license-info](http://www-03.ibm.com/software/sla/sladb.nsf/displaylis/39AFC1C1D485C4E085257E7300548B05?OpenDocument) and [was-nd-license-info] [license-info] page.
 41
+
 42
+Search for "IBM WebSphere Application Server Network Deployment" and choose the license that applies to the version you are using.
 43
+
 44
+
 45
+## Memory and Disk Requirements
 46
+
 47
+Minimum 2.0 GB of disk space for installed image and Minimum 1 GB of physical memory recommended. 
 48
+
 49
+WebSphere Application Server ND Charm requires 15 GB of root disk to download packages and install the IBM WebSphere Application Server ND Software. By default available root disk space is 8GB.
 50
+
 51
+To request a larger root disk, run the following command:
 52
+
 53
+		juju set-constraints root-disk=15G
 54
+
 55
+### Deploy
 56
+
 57
+This charm will deploy `WAS ND Nodes` to configure WAS ND dynamic cluster. WAS ND node will act as a cluster member. When you add relation between WAS ND DM and WAS ND Node charms, WAS ND DM charm creates the dynamic cluster and Node will be added as a cluster member.
 58
+
 59
+1. Deploy the WAS ND DM charm:
 60
+
 61
+	juju deploy ibm-was-nd-dm --resource ibm_im_installer=</path/to/ibm_im_installer.zip> --resource ibm_was_nd_installer1=</path/to/ibm_was_nd_installer1.zip> --resource ibm_was_nd_installer2=</path/to/ibm_was_nd_installer2.zip> --resource ibm_was_nd_installer3=</path/to/ibm_was_nd_installer3.zip>
 62
+
 63
+2. Deploy the WAS ND Node charm:
 64
+
 65
+		juju deploy ibm-was-nd-node --resource ibm_im_installer=</path/to/ibm_im_installer.zip> --resource ibm_was_nd_installer1=</path/to/ibm_was_nd_installer1.zip> --resource ibm_was_nd_installer2=</path/to/ibm_was_nd_installer2.zip> --resource ibm_was_nd_installer3=</path/to/ibm_was_nd_installer3.zip>
 66
+		
 67
+													OR
 68
+													
 69
+		juju deploy -n <num> ibm-was-nd-node --resource ibm_im_installer=</path/to/ibm_im_installer.zip> --resource ibm_was_nd_installer1=</path/to/ibm_was_nd_installer1.zip> --resource ibm_was_nd_installer2=</path/to/ibm_was_nd_installer2.zip> --resource ibm_was_nd_installer3=</path/to/ibm_was_nd_installer3.zip>
 70
+
 71
+where <num> is the number of WAS ND Node units you want to deploy
 72
+
 73
+3. Add a relation between WAS ND DM and WAS ND Node
 74
+
 75
+		juju add-relation ibm-was-nd-dm ibm-was-nd-node
 76
+
 77
+This will create WAS ND Node host which is ready to add more hosts to the WAS ND cluster. To add more units of WAS ND Node, you can use `add-unit` to add more hosts to your WAS ND cluster (each added unit will be designated as new cluster member).
 78
+
 79
+		juju add-unit ibm-was-nd-node
 80
+
 81
+This command will add a WAS ND Node to your existing WAS ND cluster.
 82
+
 83
+**Note**: This charm requires acceptance of Terms of Use. When deploying from the Charm Store, these terms will be presented to you for your consideration.
 84
+
 85
+To accept the terms:
 86
+
 87
+		juju agree ibm-im/1 ibm-was-nd/1
 88
+		juju deploy ibm-was-nd-node
 89
+
 90
+4. To Expose the IBM WAS ND Node Service to public, run the following command:
 91
+
 92
+		juju expose ibm-was-nd-node
 93
+
 94
+
 95
+### Upgrade
 96
+
 97
+Once deployed, user can upgrade the existing installation by installing fixpacks:
 98
+
 99
+If user wants to upgrade existing installation of Installtion Manger, run the following command:
100
+
101
+		juju attach ibm-was-nd-node ibm_im_fixpack=</path/to/fixpack.zip>
102
+
103
+To upgrade WAS ND Node installation:
104
+
105
+		juju attach ibm-was-nd-node ibm_was_nd_fp1=</path/to/ibm_was_nd_fp1.zip>
106
+		juju attach ibm-was-nd-node ibm_was_nd_fp2=</path/to/ibm_was_nd_fp2.zip>
107
+
108
+**Note**: WAS ND DM and WAS ND Node installation should be in same level(If you wan to upgrade WAS ND Node installation make sure that WAS ND DM also upgraded with same fixpack version). 
109
+
110
+### Verification Of WAS ND Cluster
111
+
112
+Once the IBM WAS ND Node is deployed successfully and relation is established between WAS ND DM and WAS ND Node, you can verify your WAS ND cluster by using below URLs.
113
+
114
+1. Login to DM console:
115
+
116
+		http://was-nd-dm-host:9060/ibm/console
117
+
118
+									OR
119
+
120
+		https://was-nd-dm-host:9043/ibm/console
121
+
122
+2. In the DM console click Servers > Clusters > Dynamic clusters > <dynamic_cluster_name>. On right side, click dynamic cluster members and verify the status of the cluster members. All cluster members should be started.
123
+
124
+Here was-nd-dm-host represents the public ip address of your machine, where WAS ND DM is installed. 
125
+
126
+## IBM WebSphere Application Server Network Deployment Information
127
+
128
+(1) General Information 
129
+
130
+Details about IBM WAS ND software available at [IBM Knowledge Center] [WAS-ND-Infocenter].
131
+
132
+Information on procuring WAS ND product is available at the [Passport Advantage site] [Passport-Advantage]
133
+
134
+(2) Download Information
135
+
136
+Details about WAS ND 8.5.5.0 download available [here] [[WAS-ND-8.5.5.0-download]
137
+
138
+Information about installation of WAS ND on 'ppc64le' based machine available [here] [WAS-ND-for-ppc64le]  
139
+
140
+More information about IBM IM Downloadable file and WAS ND downloadable files available [here] [IBM-IM-more-info]
141
+
142
+## Contact Information
143
+
144
+For issues with this charm, please contact IBM Juju Support team <jujusupp@us.ibm.com>
145
+
146
+<!-- Links -->
147
+
148
+[WAS-ND-Infocenter]: http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/as_ditamaps/was855_welcome_ndmp.html?lang=en
149
+
150
+[WAS-ND-product-page]: http://www-03.ibm.com/software/products/en/appserv-wasnd
151
+
152
+[WAS-ND-8.5.5.0-download]: http://www-01.ibm.com/support/docview.wss?uid=swg27038624
153
+
154
+[Passport-Advantage]: http://www-01.ibm.com/software/passportadvantage/
155
+
156
+[IBM-IM-more-info]: http://www-01.ibm.com/support/docview.wss?uid=swg24038380
157
+
158
+[WAS-ND-for-ppc64le]: http://www-304.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.installation.nd.doc/ae/cins_offerings.html?lang=en-us
159
+
160
+[WAS-ppc64le-fixpack-info]: http://www-01.ibm.com/support/docview.wss?uid=swg24040035
161
+
162
+[license-info]: http://www-03.ibm.com/software/sla/sladb.nsf/lilookup/6CCA78CD870DCA5985257D90005A5351?OpenDocument
Back to file index

bin/layer_option

 1
--- 
 2
+++ bin/layer_option
 3
@@ -0,0 +1,24 @@
 4
+#!/usr/bin/env python3
 5
+
 6
+import sys
 7
+sys.path.append('lib')
 8
+
 9
+import argparse
10
+from charms.layer import options
11
+
12
+
13
+parser = argparse.ArgumentParser(description='Access layer options.')
14
+parser.add_argument('section',
15
+                    help='the section, or layer, the option is from')
16
+parser.add_argument('option',
17
+                    help='the option to access')
18
+
19
+args = parser.parse_args()
20
+value = options(args.section).get(args.option, '')
21
+if isinstance(value, bool):
22
+    sys.exit(0 if value else 1)
23
+elif isinstance(value, list):
24
+    for val in value:
25
+        print(val)
26
+else:
27
+    print(value)
Back to file index

config.yaml

 1
--- 
 2
+++ config.yaml
 3
@@ -0,0 +1,55 @@
 4
+"options":
 5
+  "curl_url":
 6
+    "type": "string"
 7
+    "default": ""
 8
+    "description": |
 9
+      Location of the IBM product installation file(s). This should be a URL
10
+      that curl can use to download files. Multiple URLs should be separated
11
+      by a space. NOTE: cryptographic verification is required and must be
12
+      specified as part of the URL query string with the key a valid hash
13
+      algorithms md5, sha256, or sha512, and the the checksum value itself
14
+      (http://<url>?[md5|sha256|sha512]=<checksum>).
15
+      For example:
16
+        'http://example.com/file.tgz?sha256=<sum>'
17
+        'sftp://example.com/file1.tgz?md5=<sum> ftp://example.com/file2.tgz?md5=<sum>'
18
+  "curl_opts":
19
+    "type": "string"
20
+    "default": ""
21
+    "description": |
22
+      The options passed to the 'curl' command when fetching files from
23
+      curl_url. For example:
24
+        '-u <user:password>'
25
+  "license_accepted":
26
+    "type": "boolean"
27
+    "default": !!bool "false"
28
+    "description": |
29
+      Some IBM charms require acceptance of a license before installation
30
+      can proceed. If required, setting this option to True indicates that you
31
+      have read and accepted the IBM terms and conditions found in the license
32
+      file referenced by the charm.
33
+  "extra_packages":
34
+    "description": "Space separated list of extra deb packages to install.\n"
35
+    "type": "string"
36
+    "default": ""
37
+  "package_status":
38
+    "default": "install"
39
+    "type": "string"
40
+    "description": "The status of service-affecting packages will be set to this value\
41
+      \ in the dpkg database. Valid values are \"install\" and \"hold\".\n"
42
+  "install_sources":
43
+    "description": "List of extra apt sources, per charm-helpers standard format (a\
44
+      \ yaml list of strings encoded as a string). Each source may be either a line\
45
+      \ that can be added directly to sources.list(5), or in the form ppa:<user>/<ppa-name>\
46
+      \ for adding Personal Package Archives, or a distribution component to enable.\n"
47
+    "type": "string"
48
+    "default": ""
49
+  "install_keys":
50
+    "description": "List of signing keys for install_sources package sources, per\
51
+      \ charmhelpers standard format (a yaml list of strings encoded as a string).\
52
+      \ The keys should be the full ASCII armoured GPG public keys. While GPG key\
53
+      \ ids are also supported and looked up on a keyserver, operators should be aware\
54
+      \ that this mechanism is insecure. null can be used if a standard package signing\
55
+      \ key is used that will already be installed on the machine, and for PPA sources\
56
+      \ where the package signing key is securely retrieved from Launchpad.\n"
57
+    "type": "string"
58
+    "default": ""
Back to file index

copyright

 1
--- 
 2
+++ copyright
 3
@@ -0,0 +1,13 @@
 4
+Copyright 2015 IBM Corporation
 5
+
 6
+This Charm is licensed under the Apache License, Version 2.0 (the "License");
 7
+you may not use this file except in compliance with the License.
 8
+You may obtain a copy of the License at
 9
+
10
+    http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+Unless required by applicable law or agreed to in writing, software
13
+distributed under the License is distributed on an "AS IS" BASIS,
14
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+See the License for the specific language governing permissions and
16
+limitations under the License.
Back to file index

hooks/cluster-node-relation-broken

 1
--- 
 2
+++ hooks/cluster-node-relation-broken
 3
@@ -0,0 +1,19 @@
 4
+#!/usr/bin/env python3
 5
+
 6
+# Load modules from $CHARM_DIR/lib
 7
+import sys
 8
+sys.path.append('lib')
 9
+
10
+from charms.layer import basic
11
+basic.bootstrap_charm_deps()
12
+basic.init_config_states()
13
+
14
+
15
+# This will load and run the appropriate @hook and other decorated
16
+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
17
+# and $CHARM_DIR/hooks/relations.
18
+#
19
+# See https://jujucharms.com/docs/stable/authors-charm-building
20
+# for more information on this pattern.
21
+from charms.reactive import main
22
+main()
Back to file index

hooks/cluster-node-relation-changed

 1
--- 
 2
+++ hooks/cluster-node-relation-changed
 3
@@ -0,0 +1,19 @@
 4
+#!/usr/bin/env python3
 5
+
 6
+# Load modules from $CHARM_DIR/lib
 7
+import sys
 8
+sys.path.append('lib')
 9
+
10
+from charms.layer import basic
11
+basic.bootstrap_charm_deps()
12
+basic.init_config_states()
13
+
14
+
15
+# This will load and run the appropriate @hook and other decorated
16
+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
17
+# and $CHARM_DIR/hooks/relations.
18
+#
19
+# See https://jujucharms.com/docs/stable/authors-charm-building
20
+# for more information on this pattern.
21
+from charms.reactive import main
22
+main()
Back to file index

hooks/cluster-node-relation-departed

 1
--- 
 2
+++ hooks/cluster-node-relation-departed
 3
@@ -0,0 +1,19 @@
 4
+#!/usr/bin/env python3
 5
+
 6
+# Load modules from $CHARM_DIR/lib
 7
+import sys
 8
+sys.path.append('lib')
 9
+
10
+from charms.layer import basic
11
+basic.bootstrap_charm_deps()
12
+basic.init_config_states()
13
+
14
+
15
+# This will load and run the appropriate @hook and other decorated
16
+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
17
+# and $CHARM_DIR/hooks/relations.
18
+#
19
+# See https://jujucharms.com/docs/stable/authors-charm-building
20
+# for more information on this pattern.
21
+from charms.reactive import main
22
+main()
Back to file index

hooks/cluster-node-relation-joined

 1
--- 
 2
+++ hooks/cluster-node-relation-joined
 3
@@ -0,0 +1,19 @@
 4
+#!/usr/bin/env python3
 5
+
 6
+# Load modules from $CHARM_DIR/lib
 7
+import sys
 8
+sys.path.append('lib')
 9
+
10
+from charms.layer import basic
11
+basic.bootstrap_charm_deps()
12
+basic.init_config_states()
13
+
14
+
15
+# This will load and run the appropriate @hook and other decorated
16
+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
17
+# and $CHARM_DIR/hooks/relations.
18
+#
19
+# See https://jujucharms.com/docs/stable/authors-charm-building
20
+# for more information on this pattern.
21
+from charms.reactive import main
22
+main()
Back to file index

hooks/config-changed

 1
--- 
 2
+++ hooks/config-changed
 3
@@ -0,0 +1,19 @@
 4
+#!/usr/bin/env python3
 5
+
 6
+# Load modules from $CHARM_DIR/lib
 7
+import sys
 8
+sys.path.append('lib')
 9
+
10
+from charms.layer import basic
11
+basic.bootstrap_charm_deps()
12
+basic.init_config_states()
13
+
14
+
15
+# This will load and run the appropriate @hook and other decorated
16
+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
17
+# and $CHARM_DIR/hooks/relations.
18
+#
19
+# See https://jujucharms.com/docs/stable/authors-charm-building
20
+# for more information on this pattern.
21
+from charms.reactive import main
22
+main()
Back to file index

hooks/hook.template

 1
--- 
 2
+++ hooks/hook.template
 3
@@ -0,0 +1,19 @@
 4
+#!/usr/bin/env python3
 5
+
 6
+# Load modules from $CHARM_DIR/lib
 7
+import sys
 8
+sys.path.append('lib')
 9
+
10
+from charms.layer import basic
11
+basic.bootstrap_charm_deps()
12
+basic.init_config_states()
13
+
14
+
15
+# This will load and run the appropriate @hook and other decorated
16
+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
17
+# and $CHARM_DIR/hooks/relations.
18
+#
19
+# See https://jujucharms.com/docs/stable/authors-charm-building
20
+# for more information on this pattern.
21
+from charms.reactive import main
22
+main()
Back to file index

hooks/install

 1
--- 
 2
+++ hooks/install
 3
@@ -0,0 +1,19 @@
 4
+#!/usr/bin/env python3
 5
+
 6
+# Load modules from $CHARM_DIR/lib
 7
+import sys
 8
+sys.path.append('lib')
 9
+
10
+from charms.layer import basic
11
+basic.bootstrap_charm_deps()
12
+basic.init_config_states()
13
+
14
+
15
+# This will load and run the appropriate @hook and other decorated
16
+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
17
+# and $CHARM_DIR/hooks/relations.
18
+#
19
+# See https://jujucharms.com/docs/stable/authors-charm-building
20
+# for more information on this pattern.
21
+from charms.reactive import main
22
+main()
Back to file index

hooks/leader-elected

 1
--- 
 2
+++ hooks/leader-elected
 3
@@ -0,0 +1,19 @@
 4
+#!/usr/bin/env python3
 5
+
 6
+# Load modules from $CHARM_DIR/lib
 7
+import sys
 8
+sys.path.append('lib')
 9
+
10
+from charms.layer import basic
11
+basic.bootstrap_charm_deps()
12
+basic.init_config_states()
13
+
14
+
15
+# This will load and run the appropriate @hook and other decorated
16
+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
17
+# and $CHARM_DIR/hooks/relations.
18
+#
19
+# See https://jujucharms.com/docs/stable/authors-charm-building
20
+# for more information on this pattern.
21
+from charms.reactive import main
22
+main()
Back to file index

hooks/leader-settings-changed

 1
--- 
 2
+++ hooks/leader-settings-changed
 3
@@ -0,0 +1,19 @@
 4
+#!/usr/bin/env python3
 5
+
 6
+# Load modules from $CHARM_DIR/lib
 7
+import sys
 8
+sys.path.append('lib')
 9
+
10
+from charms.layer import basic
11
+basic.bootstrap_charm_deps()
12
+basic.init_config_states()
13
+
14
+
15
+# This will load and run the appropriate @hook and other decorated
16
+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
17
+# and $CHARM_DIR/hooks/relations.
18
+#
19
+# See https://jujucharms.com/docs/stable/authors-charm-building
20
+# for more information on this pattern.
21
+from charms.reactive import main
22
+main()
Back to file index

hooks/relations/dm-node/@

 1
--- 
 2
+++ hooks/relations/dm-node/@
 3
@@ -0,0 +1,75 @@
 4
+# Licensed under the Apache License, Version 5.0 (the "License");
 5
+# you may not use this file except in compliance with the License.
 6
+# You may obtain a copy of the License at
 7
+#
 8
+#     http://www.apache.org/licenses/LICENSE-2.0
 9
+#
10
+# Unless required by applicable law or agreed to in writing, software
11
+# distributed under the License is distributed on an "AS IS" BASIS,
12
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+# See the License for the specific language governing permissions and
14
+# limitations under the License.
15
+
16
+from charms.reactive import hook
17
+from charms.reactive import RelationBase
18
+from charms.reactive import scopes
19
+
20
+
21
+class db2Requires(RelationBase):
22
+    scope = scopes.GLOBAL
23
+    
24
+    auto_accessors = ['ssh_key1', 'ssh_key2' , 'ssh_key32']
25
+ 
26
+    @hook('{requires:db2}-relation-joined')
27
+    def joined(self):
28
+        self.set_state('{relation_name}.connected')
29
+
30
+    @hook('{requires:db2}-relation-changed')
31
+    def changed(self):
32
+        self.set_state('{relation_name}.available')
33
+
34
+    @hook('{requires:db2}-relation-departed')
35
+    def departed(self):
36
+        self.remove_state('{relation_name}.connected')
37
+        self.remove_state('{relation_name}.available')
38
+
39
+
40
+    # For minor upgrades, provide a way to set java-version independently
41
+    def set_port(self, db2_port):
42
+        self.set_remote('db2_port', db2_port)
43
+
44
+    def unset_ready(self):
45
+        self.set_remote('db2_ready', False)
46
+    
47
+    def get_db_values(self):
48
+        """
49
+        Get the connection string, if available, or None.
50
+        """
51
+        data = {
52
+            'host': self.host(),
53
+            'port': db2-port,
54
+            'path': db2-path,
55
+        }
56
+        if all(data.values()):
57
+            return str.format(
58
+                'host={host} port={port} =path{path}',
59
+                **data)
60
+        return None 
61
+
62
+    def get_port(self):
63
+        #print("In get_port function ",db2_port)
64
+        return self.get_remote('db2_port')
65
+    
66
+#to pass the ssh keys
67
+    def set_ssh_keys(self,ssh_key1,ssh_key2,ssh_key3,dbnames):
68
+        self.set_remote(data={
69
+            'ssh_key1': ssh_key1,
70
+            'ssh_key2': ssh_key2,
71
+            'ssh_key3': ssh_key3,	
72
+            'dbnames': dbnames,
73
+        })
74
+        print("In set_ssh_keys",ssh_key1,ssh_key2,ssh_key3,dbnames)
75
+
76
+
77
+
78
+ 
Back to file index

hooks/relations/dm-node/README.md

 1
--- 
 2
+++ hooks/relations/dm-node/README.md
 3
@@ -0,0 +1,38 @@
 4
+Overview
 5
+-----------
 6
+
 7
+This interface layer handles the communication between a `IBM WAS ND DM` and `IBM WAS ND Node` charms.
 8
+The provider side of this interface provides the WAS ND DM service. The consumer/Requires part will be the WAS ND Node which wants the WAS ND DM dmgruser, dmgrpw, hostname, dminstallpath and profile name to configure the WAS ND dynamic cluster.
 9
+
10
+
11
+Usage
12
+------
13
+
14
+#### Provides
15
+IBM WebSphere Application Server ND DM will provide this interface. This interface layer will set the following states, as appropriate:
16
+
17
+ - `{relation_name}.connected`: The relation is established, WAS ND DM service is ready to send it's information.
18
+ 
19
+ - `{relation_name}.available`: WAS ND DM has provided its connection information, and is ready to accept requests from the WAS ND Node charm.
20
+ 
21
+ - `{relation_name}.departed` : The relation has been removed. Any cleanup related to the consumer charm(WAS ND Node) should happen now on the WAS ND DM charm since the consumer is going away.
22
+
23
+
24
+#### Requires
25
+
26
+Consumer charm `IBM WAS ND Node` will require this interface to connect to WAS ND DM so that they can share information to configure dynamic cluster setup. This interface layer will set the following states, as appropriate:
27
+
28
+- `{relation_name}.connected` : The consumer charm has been related to a WAS ND DM provider charm. At this point, the charm waits for Provider charm to send configuration details like dmgruser, dmgrpw, hostname, dminstallpath and profile name.
29
+
30
+- `{relation_name}.ready` : WAS ND Node is now ready to access the configuration details provided by WAS ND DM charm. The WAS ND Node charm can access the configuration details using the below methods:
31
+
32
+    - `get_was_dm_install_path()` - returns the Installation path of WAS ND DM.
33
+    - `get_was_dm_hostname()` - returns host name of WAS ND DM.
34
+    - `get_dmgradminuser()` - returns user name to login DM console.
35
+    - `get_dmgrpwd()` - returns password to login DM console.
36
+    - `get_was_dm_profile_name()` - returns the WAS ND DM profile name.
37
+	
38
+Once the relation established, send the WAS ND Node host name to WAS ND DM. 
39
+    - `set_was_node_hostname()` - returns running port of WAS.
40
+
41
+
Back to file index

hooks/relations/dm-node/interface.yaml

1
--- 
2
+++ hooks/relations/dm-node/interface.yaml
3
@@ -0,0 +1,5 @@
4
+name: dm-node 
5
+summary: WAS ND provides the relation to IBM WAS ND Node charm
6
+maintainer: IBM Juju Support Team <jujusupp@us.ibm.com>
7
+version: 1
8
+#repo: ""
Back to file index

hooks/relations/dm-node/provides.py

 1
--- 
 2
+++ hooks/relations/dm-node/provides.py
 3
@@ -0,0 +1,61 @@
 4
+from charms.reactive import hook
 5
+from charms.reactive import RelationBase
 6
+from charms.reactive import scopes
 7
+
 8
+
 9
+class wasdmProvides(RelationBase):
10
+    # Every unit connecting will get the same information
11
+    scope = scopes.UNIT
12
+
13
+    @hook('{provides:dm-node}-relation-{joined}')
14
+    def joined(self):
15
+        conversation = self.conversation()
16
+        conversation.set_state('{relation_name}.connected')
17
+        conversation.remove_state('{relation_name}.departed')
18
+
19
+    @hook('{provides:dm-node}-relation-changed')
20
+    def changed(self):
21
+        conversation = self.conversation()
22
+        conversation.set_state('{relation_name}.available')
23
+
24
+    @hook('{provides:dm-node}-relation-{broken}')
25
+    def broken(self):
26
+        conversation = self.conversation()
27
+        conversation.remove_state('{relation_name}.connected')
28
+        conversation.remove_state('{relation_name}.available')
29
+        conversation.set_state('{relation_name}.departed')
30
+
31
+    def dismiss(self):
32
+        for conv in self.conversations():
33
+            conv.remove_state('{relation_name}.departed')
34
+
35
+    def reset_states(self, service):
36
+        conversation = self.conversation(service)
37
+        conversation.remove_state('{relation_name}.connected')
38
+        conversation.remove_state('{relation_name}.departed')
39
+
40
+    def set_was_dm_details(self, hostname, dminstallpath,
41
+                           profilename, dmgruser, dmgrpwd):
42
+        for conversation in self.conversations():
43
+            conversation.set_remote(data={
44
+                                          'hostname': hostname,
45
+                                          'dminstallpath': dminstallpath,
46
+                                          'profilename': profilename,
47
+                                          'dmgruser': dmgruser,
48
+                                          'dmgrpwd': dmgrpwd})
49
+
50
+    def get_was_node_ip(self):
51
+        ip = []
52
+        for conv in self.conversations():
53
+            ip.append(conv.get_remote('private-address') +
54
+                      " " + (conv.get_remote('node_hostname')))
55
+        return ip
56
+
57
+    def services(self):
58
+        """
59
+        Return a list of services connecting to WASND.
60
+        """
61
+        service = []
62
+        for conversation in self.conversations():
63
+            service.append(conversation.scope)
64
+        return service
Back to file index

hooks/relations/dm-node/requires.py

 1
--- 
 2
+++ hooks/relations/dm-node/requires.py
 3
@@ -0,0 +1,49 @@
 4
+from charms.reactive import hook
 5
+from charms.reactive import RelationBase
 6
+from charms.reactive import scopes
 7
+
 8
+
 9
+class ihsRequires(RelationBase):
10
+    scope = scopes.GLOBAL
11
+
12
+    auto_accessors = ['hostname', 'dmgruser', 'dmgrpwd']
13
+
14
+    @hook('{requires:dm-node}-relation-joined')
15
+    def joined(self):
16
+        self.remove_state('{relation_name}.departed')
17
+        self.set_state('{relation_name}.connected')
18
+
19
+    @hook('{requires:dm-node}-relation-changed')
20
+    def changed(self):
21
+        self.remove_state('{relation_name}.departed')
22
+        if str(self.get_remote('hostname')) != "None":
23
+            self.set_state('{relation_name}.ready')
24
+
25
+    @hook('{requires:dm-node}-relation-departed')
26
+    def departed(self):
27
+        self.remove_state('{relation_name}.connected')
28
+        self.remove_state('{relation_name}.ready')
29
+        self.set_state('{relation_name}.departed')
30
+
31
+    def get_was_dm_hostname(self):
32
+        return self.get_remote('hostname')
33
+
34
+    def get_was_dm_ip(self):
35
+        return self.get_remote('private-address')
36
+
37
+    def get_was_dm_install_path(self):
38
+        return self.get_remote('dminstallpath')
39
+
40
+    def get_was_dm_profile_name(self):
41
+        return self.get_remote('profilename')
42
+
43
+    def get_dmgradminuser(self):
44
+        return self.get_remote('dmgruser')
45
+
46
+    def get_dmgrpwd(self):
47
+        return self.get_remote('dmgrpwd')
48
+
49
+    def set_was_node_hostname(self, node_hostname):
50
+        for conversation in self.conversations():
51
+            conversation.set_remote(data={
52
+                                          'node_hostname': node_hostname})
Back to file index

hooks/start

 1
--- 
 2
+++ hooks/start
 3
@@ -0,0 +1,19 @@
 4
+#!/usr/bin/env python3
 5
+
 6
+# Load modules from $CHARM_DIR/lib
 7
+import sys
 8
+sys.path.append('lib')
 9
+
10
+from charms.layer import basic
11
+basic.bootstrap_charm_deps()
12
+basic.init_config_states()
13
+
14
+
15
+# This will load and run the appropriate @hook and other decorated
16
+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
17
+# and $CHARM_DIR/hooks/relations.
18
+#
19
+# See https://jujucharms.com/docs/stable/authors-charm-building
20
+# for more information on this pattern.
21
+from charms.reactive import main
22
+main()
Back to file index

hooks/stop

 1
--- 
 2
+++ hooks/stop
 3
@@ -0,0 +1,19 @@
 4
+#!/usr/bin/env python3
 5
+
 6
+# Load modules from $CHARM_DIR/lib
 7
+import sys
 8
+sys.path.append('lib')
 9
+
10
+from charms.layer import basic
11
+basic.bootstrap_charm_deps()
12
+basic.init_config_states()
13
+
14
+
15
+# This will load and run the appropriate @hook and other decorated
16
+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
17
+# and $CHARM_DIR/hooks/relations.
18
+#
19
+# See https://jujucharms.com/docs/stable/authors-charm-building
20
+# for more information on this pattern.
21
+from charms.reactive import main
22
+main()
Back to file index

hooks/update-status

 1
--- 
 2
+++ hooks/update-status
 3
@@ -0,0 +1,19 @@
 4
+#!/usr/bin/env python3
 5
+
 6
+# Load modules from $CHARM_DIR/lib
 7
+import sys
 8
+sys.path.append('lib')
 9
+
10
+from charms.layer import basic
11
+basic.bootstrap_charm_deps()
12
+basic.init_config_states()
13
+
14
+
15
+# This will load and run the appropriate @hook and other decorated
16
+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
17
+# and $CHARM_DIR/hooks/relations.
18
+#
19
+# See https://jujucharms.com/docs/stable/authors-charm-building
20
+# for more information on this pattern.
21
+from charms.reactive import main
22
+main()
Back to file index

hooks/upgrade-charm

 1
--- 
 2
+++ hooks/upgrade-charm
 3
@@ -0,0 +1,28 @@
 4
+#!/usr/bin/env python3
 5
+
 6
+# Load modules from $CHARM_DIR/lib
 7
+import os
 8
+import sys
 9
+sys.path.append('lib')
10
+
11
+# This is an upgrade-charm context, make sure we install latest deps
12
+if not os.path.exists('wheelhouse/.upgrade'):
13
+    open('wheelhouse/.upgrade', 'w').close()
14
+    if os.path.exists('wheelhouse/.bootstrapped'):
15
+        os.unlink('wheelhouse/.bootstrapped')
16
+else:
17
+    os.unlink('wheelhouse/.upgrade')
18
+
19
+from charms.layer import basic
20
+basic.bootstrap_charm_deps()
21
+basic.init_config_states()
22
+
23
+
24
+# This will load and run the appropriate @hook and other decorated
25
+# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive,
26
+# and $CHARM_DIR/hooks/relations.
27
+#
28
+# See https://jujucharms.com/docs/stable/authors-charm-building
29
+# for more information on this pattern.
30
+from charms.reactive import main
31
+main()
Back to file index

icon.svg

 1
--- 
 2
+++ icon.svg
 3
@@ -0,0 +1,53 @@
 4
+<?xml version="1.0" encoding="UTF-8"?>
 5
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
 6
+<!-- Creator: CorelDRAW X6 -->
 7
+<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="1in" height="0.999996in" version="1.1" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd"
 8
+viewBox="0 0 1116 1116"
 9
+ xmlns:xlink="http://www.w3.org/1999/xlink">
10
+ <defs>
11
+   <linearGradient id="id0" gradientUnits="userSpaceOnUse" x1="558.139" y1="0" x2="558.139" y2="1116.27">
12
+    <stop offset="0" stop-color="#BFA6E6"/>
13
+    <stop offset="1" stop-color="#6C5393"/>
14
+   </linearGradient>
15
+   <mask id="id1">
16
+     <linearGradient id="id2" gradientUnits="userSpaceOnUse" x1="558.139" y1="65.2803" x2="558.139" y2="342.715">
17
+      <stop offset="0" stop-opacity="1" stop-color="white"/>
18
+      <stop offset="0.141176" stop-opacity="-10.5451" stop-color="white"/>
19
+      <stop offset="1" stop-opacity="0" stop-color="white"/>
20
+     </linearGradient>
21
+    <rect fill="url(#id2)" width="1116" height="408"/>
22
+   </mask>
23
+ </defs>
24
+ <g id="Layer_x0020_1">
25
+  <metadata id="CorelCorpID_0Corel-Layer"/>
26
+  <path id="Background" fill="url(#id0)" d="M0 754l0 -392c0,-317 45,-362 362,-362l393 0c316,0 361,45 361,362l0 392c0,317 -45,362 -361,362l-393 0c-317,0 -362,-45 -362,-362z"/>
27
+  <path fill="#999999" mask="url(#id1)" d="M0 408l0 -46c0,-317 45,-362 362,-362l393 0c316,0 361,45 361,362l0 46c0,-317 -45,-362 -361,-362l-393 0c-317,0 -362,45 -362,362z"/>
28
+  <g id="_195711952">
29
+   <path fill="#CCCCCC" fill-rule="nonzero" d="M426 711l-54 0 -54 -195 -55 195 -53 0 -71 -249 -29 0 0 -47 120 0 0 47 -32 0 41 156 54 -203 48 0 57 201 39 -154 -33 0 0 -47 121 0 0 47 -33 0 -66 249zm210 -231l-1 0 -37 102 75 0 -37 -102zm36 190l33 0 -18 -44 -104 0 -17 44 32 0 0 41 -121 0 0 -47 32 0 86 -202 -33 0 0 -47 100 0 103 249 32 0 0 47 -125 0 0 -41zm201 -47c0,7 1,12 3,18 2,5 5,10 8,14 4,5 9,8 14,10 5,3 12,4 19,4 12,0 22,-4 31,-11 8,-7 12,-17 12,-30 0,-7 -1,-14 -5,-18 -3,-5 -7,-9 -12,-13 -5,-3 -10,-5 -16,-7 -6,-2 -12,-4 -18,-6 -10,-3 -20,-6 -30,-9 -9,-4 -19,-9 -28,-16 -21,-16 -32,-38 -32,-65 0,-12 2,-23 7,-34 5,-10 12,-19 20,-27 8,-8 18,-13 29,-18 10,-4 22,-6 34,-6 10,0 20,2 29,5 9,4 17,10 23,18l0 -17 44 0 0 80 -51 0c0,-11 -4,-21 -11,-28 -8,-7 -17,-11 -28,-11 -11,0 -20,3 -28,10 -8,6 -12,15 -12,27 0,7 1,13 4,18 3,5 7,9 12,12 4,3 10,5 15,7 6,2 12,3 18,5 11,3 22,7 33,10 10,4 20,10 30,17 10,8 17,17 22,28 5,10 8,22 8,34 0,14 -3,26 -8,37 -4,12 -11,21 -19,30 -8,8 -18,14 -30,19 -11,5 -24,7 -37,7 -12,0 -22,-2 -32,-6 -10,-4 -18,-10 -25,-19l0 19 -45 0 0 -88 52 0z"/>
30
+   <g>
31
+    <path fill="#C8C8C8" d="M425 711c-17,0 -35,0 -53,0 -18,-65 -37,-130 -55,-196 -18,66 -36,131 -55,196 -17,0 -35,0 -52,0 -24,-83 -48,-166 -71,-249 -10,0 -20,0 -30,0 0,-16 0,-32 0,-47 40,0 80,0 120,0 0,15 0,31 0,47 -10,0 -21,0 -32,0 14,52 28,104 42,156 18,-68 36,-136 54,-203 15,0 31,0 47,0 19,67 38,134 57,201 13,-51 27,-103 40,-154 -11,0 -22,0 -33,0 0,-16 0,-32 0,-47 40,0 80,0 120,0 0,15 0,31 0,47 -11,0 -22,0 -33,0 -22,83 -44,166 -66,249zm210 -231c0,0 0,0 0,0 -13,34 -25,68 -38,101 25,0 51,0 76,0 -13,-33 -25,-67 -38,-101zm37 189c10,0 21,0 32,0 -5,-14 -11,-29 -17,-44 -35,0 -70,0 -104,0 -6,15 -12,30 -17,44 10,0 21,0 32,0 0,14 0,28 0,42 -41,0 -81,0 -121,0 0,-16 0,-32 0,-47 10,0 21,0 31,0 29,-68 58,-135 87,-202 -11,0 -22,0 -33,0 0,-16 0,-32 0,-47 33,0 66,0 99,0 35,83 69,166 104,249 10,0 21,0 31,0 0,15 0,31 0,47 -41,0 -83,0 -124,0 0,-14 0,-28 0,-42zm200 -46c0,6 1,12 3,17 2,6 5,11 9,15 4,4 8,7 14,10 5,2 11,3 18,3 12,0 23,-3 31,-11 8,-7 13,-17 13,-29 0,-8 -2,-14 -5,-19 -3,-5 -7,-9 -12,-12 -5,-3 -10,-6 -16,-8 -6,-2 -12,-3 -18,-5 -11,-3 -21,-6 -30,-10 -10,-3 -19,-8 -28,-15 -22,-16 -33,-38 -33,-65 0,-12 3,-24 8,-34 5,-11 11,-20 19,-27 9,-8 18,-14 29,-18 11,-4 22,-7 34,-7 10,0 20,2 29,6 10,3 18,9 24,17 0,-5 0,-11 0,-16 14,0 29,0 43,0 0,26 0,53 0,79 -17,0 -34,0 -51,0 0,-11 -4,-20 -11,-27 -7,-8 -16,-11 -27,-11 -11,0 -21,3 -29,9 -8,7 -11,16 -11,28 0,7 1,13 4,17 3,5 7,9 11,12 5,3 10,6 16,7 6,2 11,4 17,6 12,3 23,6 33,10 11,4 21,9 31,17 9,7 17,16 22,27 5,11 7,22 7,35 0,13 -2,25 -7,37 -5,11 -11,21 -19,29 -9,9 -19,15 -30,20 -12,4 -24,7 -38,7 -11,0 -22,-2 -31,-6 -10,-4 -18,-11 -26,-20 0,7 0,13 0,20 -15,0 -29,0 -44,0 0,-29 0,-59 0,-88 17,0 34,0 51,0z"/>
32
+    <path fill="#C5C5C5" d="M425 710c-18,0 -36,0 -54,0 -18,-65 -36,-130 -54,-195 -19,65 -37,130 -55,195 -18,0 -35,0 -53,0 -24,-83 -47,-166 -71,-249 -10,0 -20,0 -29,0 0,-15 0,-31 0,-47 40,0 80,0 120,0 0,16 0,32 0,47 -11,0 -22,0 -32,0 14,52 28,104 42,156 17,-68 35,-135 53,-203 16,0 32,0 48,0 19,67 38,134 57,201 13,-51 26,-102 40,-154 -12,0 -23,0 -34,0 0,-15 0,-31 0,-47 40,0 81,0 121,0 0,16 0,32 0,47 -11,0 -22,0 -33,0 -22,83 -44,166 -66,249zm210 -231c0,0 0,0 0,0 -13,34 -26,68 -38,102 25,0 50,0 75,0 -12,-34 -25,-68 -37,-102zm36 190c11,0 22,0 33,0 -6,-15 -12,-30 -18,-44 -34,0 -69,0 -104,0 -5,14 -11,29 -17,44 11,0 22,0 32,0 0,14 0,28 0,41 -40,0 -80,0 -121,0 0,-15 0,-31 0,-47 11,0 21,0 32,0 29,-67 57,-134 86,-202 -11,0 -22,0 -33,0 0,-15 0,-31 0,-47 34,0 67,0 100,0 34,83 69,166 103,249 11,0 22,0 32,0 0,16 0,32 0,47 -42,0 -83,0 -125,0 0,-13 0,-27 0,-41zm201 -46c0,6 1,11 3,17 2,5 5,10 8,14 4,5 9,8 14,10 5,3 12,4 19,4 12,0 22,-4 31,-11 8,-7 12,-17 12,-30 0,-7 -1,-14 -5,-18 -3,-5 -7,-9 -12,-12 -4,-4 -10,-6 -16,-8 -6,-2 -12,-4 -17,-6 -11,-3 -21,-6 -31,-9 -9,-4 -18,-9 -28,-16 -21,-16 -32,-37 -32,-65 0,-12 2,-23 7,-34 5,-10 12,-19 20,-27 8,-7 18,-13 29,-18 10,-4 22,-6 34,-6 10,0 20,2 29,5 9,4 17,10 23,18 0,-6 0,-11 0,-17 15,0 29,0 44,0 0,27 0,53 0,80 -17,0 -34,0 -51,0 0,-11 -4,-20 -11,-28 -7,-7 -17,-11 -28,-11 -11,0 -20,3 -28,10 -8,6 -12,16 -12,27 0,7 2,13 4,18 3,5 7,9 12,12 5,3 10,5 15,7 6,2 12,3 18,5 11,3 22,7 33,10 10,4 20,10 30,17 10,8 17,17 22,28 5,10 8,22 8,34 0,14 -3,26 -7,37 -5,12 -12,21 -20,30 -8,8 -18,15 -30,19 -11,5 -24,7 -37,7 -12,0 -22,-2 -32,-6 -10,-4 -18,-10 -25,-19 0,6 0,13 0,19 -15,0 -30,0 -45,0 0,-29 0,-58 0,-87 17,0 34,0 52,0z"/>
33
+    <path fill="#C1C1C1" d="M424 710c-17,0 -35,0 -53,0 -18,-65 -37,-130 -55,-195 -18,65 -36,130 -55,195 -17,0 -35,0 -52,0 -24,-83 -48,-166 -71,-249 -10,0 -20,0 -30,0 0,-16 0,-32 0,-47 40,0 80,0 121,0 0,15 0,31 0,47 -11,0 -22,0 -33,0 14,52 28,104 42,156 18,-68 36,-136 54,-203 16,0 31,0 47,0 19,67 38,134 57,201 14,-51 27,-103 40,-154 -11,0 -22,0 -33,0 0,-16 0,-32 0,-47 40,0 80,0 120,0 0,15 0,31 0,47 -11,0 -22,0 -33,0 -22,83 -44,166 -66,249zm210 -231c0,0 0,0 0,0 -13,34 -25,68 -38,102 25,0 51,0 76,0 -13,-34 -25,-68 -38,-102zm37 190c11,0 21,0 32,0 -5,-15 -11,-30 -17,-45 -35,0 -69,0 -104,0 -6,15 -12,30 -17,45 10,0 21,0 32,0 0,13 0,27 0,41 -41,0 -81,0 -121,0 0,-16 0,-32 0,-47 10,0 21,0 31,0 29,-68 58,-135 87,-202 -11,0 -22,0 -33,0 0,-16 0,-32 0,-47 33,0 66,0 99,0 35,83 69,166 104,249 11,0 21,0 32,0 0,15 0,31 0,47 -42,0 -84,0 -125,0 0,-14 0,-28 0,-41zm200 -47c0,6 1,12 3,17 2,6 5,11 9,15 4,4 8,7 14,10 5,2 11,3 18,3 13,0 23,-3 31,-11 9,-7 13,-17 13,-29 0,-8 -2,-14 -5,-19 -3,-5 -7,-9 -12,-12 -5,-3 -10,-6 -16,-8 -6,-2 -12,-3 -18,-5 -11,-3 -21,-6 -30,-10 -10,-3 -19,-8 -28,-15 -22,-16 -32,-38 -32,-65 0,-12 2,-24 7,-34 5,-11 11,-20 20,-27 8,-8 17,-14 28,-18 11,-4 22,-7 34,-7 10,0 20,2 29,6 10,3 18,9 24,17 0,-5 0,-11 0,-16 14,0 29,0 43,0 0,26 0,53 0,79 -17,0 -34,0 -51,0 0,-11 -4,-20 -11,-27 -7,-8 -16,-11 -27,-11 -11,0 -21,3 -29,9 -7,7 -11,16 -11,28 0,7 1,13 4,18 3,4 7,8 11,11 5,3 10,6 16,7 6,2 11,4 17,6 12,3 23,6 33,10 11,4 21,9 31,17 9,7 17,17 22,27 5,11 7,22 7,35 0,13 -2,25 -7,37 -5,11 -11,21 -19,29 -9,9 -19,15 -30,20 -12,4 -24,7 -38,7 -11,0 -22,-2 -31,-6 -10,-4 -18,-11 -26,-19 0,6 0,13 0,19 -14,0 -29,0 -44,0 0,-29 0,-59 0,-88 17,0 34,0 51,0z"/>
34
+    <path fill="#BEBEBE" d="M424 710c-18,0 -36,0 -54,0 -18,-66 -36,-131 -54,-196 -19,65 -37,130 -55,196 -18,0 -35,0 -53,0 -24,-83 -47,-166 -71,-249 -10,0 -19,0 -29,0 0,-16 0,-32 0,-48 40,0 80,0 120,0 0,16 0,32 0,48 -11,0 -22,0 -32,0 14,51 28,103 42,155 17,-67 35,-135 53,-203 16,0 32,0 48,0 19,67 38,134 57,202 13,-52 26,-103 40,-154 -11,0 -23,0 -34,0 0,-16 0,-32 0,-48 41,0 81,0 121,0 0,16 0,32 0,48 -11,0 -22,0 -33,0 -22,83 -44,166 -66,249zm210 -232c0,0 0,0 0,0 -13,34 -26,68 -38,102 25,0 50,0 75,0 -12,-34 -25,-68 -37,-102zm36 190c11,0 22,0 33,0 -6,-15 -12,-30 -18,-44 -34,0 -69,0 -104,0 -5,14 -11,29 -17,44 11,0 22,0 32,0 0,14 0,28 0,42 -40,0 -80,0 -121,0 0,-16 0,-32 0,-48 11,0 21,0 32,0 29,-67 58,-134 86,-201 -11,0 -22,0 -32,0 0,-16 0,-32 0,-48 33,0 66,0 99,0 34,83 69,166 104,249 10,0 21,0 31,0 0,16 0,32 0,48 -42,0 -83,0 -125,0 0,-14 0,-28 0,-42zm201 -46c0,6 1,11 3,17 2,6 5,10 8,15 4,4 9,7 14,9 6,3 12,4 19,4 12,0 22,-4 31,-11 8,-7 12,-17 12,-30 0,-7 -1,-14 -5,-18 -3,-5 -7,-9 -12,-12 -4,-4 -10,-6 -16,-8 -6,-2 -12,-4 -17,-5 -11,-4 -21,-7 -31,-10 -9,-4 -18,-9 -28,-16 -21,-16 -32,-37 -32,-65 0,-12 3,-23 7,-34 5,-10 12,-19 20,-27 8,-7 18,-13 29,-18 11,-4 22,-6 34,-6 10,0 20,2 29,5 9,4 17,10 23,18 0,-6 0,-11 0,-17 15,0 29,0 44,0 0,27 0,53 0,80 -17,0 -34,0 -51,0 0,-11 -4,-20 -11,-28 -7,-7 -17,-11 -28,-11 -11,0 -20,4 -28,10 -8,7 -12,16 -12,27 0,7 2,13 4,18 3,5 7,9 12,12 5,3 10,5 15,7 6,2 12,3 18,5 11,3 22,7 33,11 10,3 21,9 30,16 10,8 17,17 22,28 5,10 8,22 8,34 0,14 -3,26 -7,37 -5,12 -12,22 -20,30 -8,8 -18,15 -30,19 -11,5 -24,7 -37,7 -12,0 -22,-2 -32,-6 -9,-4 -18,-10 -25,-19 0,7 0,13 0,20 -15,0 -30,0 -45,0 0,-30 0,-59 0,-88 17,0 34,0 52,0z"/>
35
+    <path fill="#BABABA" d="M424 709c-18,0 -36,0 -54,0 -18,-65 -37,-130 -55,-195 -18,65 -36,130 -55,195 -17,0 -35,0 -52,0 -24,-83 -48,-166 -71,-249 -10,0 -20,0 -30,0 0,-16 0,-32 0,-47 40,0 80,0 121,0 0,15 0,31 0,47 -11,0 -22,0 -33,0 14,52 28,104 42,156 18,-68 36,-136 54,-203 16,0 32,0 47,0 19,67 38,134 57,201 14,-51 27,-103 40,-154 -11,0 -22,0 -33,0 0,-16 0,-32 0,-47 40,0 80,0 120,0 0,15 0,31 0,47 -11,0 -22,0 -32,0 -22,83 -44,166 -66,249zm210 -231c-1,0 -1,0 -1,0 -12,34 -25,68 -38,102 26,0 51,0 76,0 -13,-34 -25,-68 -37,-102zm36 190c11,0 22,0 32,0 -5,-15 -11,-30 -17,-45 -35,0 -69,0 -104,0 -6,15 -12,30 -17,45 10,0 21,0 32,0 0,13 0,27 0,41 -40,0 -81,0 -121,0 0,-16 0,-31 0,-47 11,0 21,0 32,0 28,-67 57,-135 86,-202 -11,0 -22,0 -33,0 0,-16 0,-32 0,-47 33,0 66,0 99,0 35,83 69,166 104,249 11,0 21,0 32,0 0,16 0,31 0,47 -42,0 -84,0 -125,0 0,-14 0,-28 0,-41zm200 -47c0,6 1,12 3,18 2,5 5,10 9,14 4,4 8,7 14,10 5,2 11,3 18,3 13,0 23,-3 31,-10 9,-8 13,-18 13,-30 0,-8 -2,-14 -5,-19 -3,-5 -7,-9 -12,-12 -5,-3 -10,-6 -16,-8 -6,-1 -12,-3 -18,-5 -11,-3 -21,-6 -30,-10 -10,-3 -19,-8 -28,-15 -22,-16 -32,-38 -32,-65 0,-12 2,-24 7,-34 5,-11 11,-20 20,-27 8,-8 17,-14 28,-18 11,-4 22,-7 34,-7 11,0 20,2 30,6 9,3 17,9 23,17 0,-5 0,-11 0,-16 14,0 29,0 43,0 0,26 0,53 0,79 -17,0 -34,0 -50,0 -1,-11 -4,-20 -12,-27 -7,-8 -16,-11 -27,-11 -11,0 -21,3 -29,10 -7,6 -11,15 -11,27 0,7 1,13 4,18 3,4 7,8 11,11 5,3 10,6 16,7 6,2 11,4 17,6 12,3 23,6 33,10 11,4 21,9 31,17 9,7 17,17 22,27 5,11 7,22 7,35 0,13 -2,26 -7,37 -5,11 -11,21 -19,29 -9,9 -19,15 -30,20 -12,5 -24,7 -38,7 -11,0 -22,-2 -31,-6 -10,-4 -18,-11 -25,-19 0,6 0,13 0,19 -15,0 -30,0 -45,0 0,-29 0,-59 0,-88 17,0 34,0 51,0z"/>
36
+    <path fill="#B6B6B6" d="M423 709c-18,0 -36,0 -53,0 -19,-66 -37,-131 -55,-196 -19,65 -37,130 -55,196 -18,0 -35,0 -53,0 -23,-83 -47,-166 -71,-249 -10,0 -19,0 -29,0 0,-16 0,-32 0,-48 40,0 80,0 120,0 0,16 0,32 0,48 -11,0 -21,0 -32,0 14,51 28,103 42,155 18,-67 35,-135 53,-203 16,0 32,0 48,0 19,67 38,134 57,202 13,-52 26,-103 40,-154 -11,0 -22,0 -34,0 0,-16 0,-32 0,-48 41,0 81,0 121,0 0,16 0,32 0,48 -11,0 -22,0 -33,0 -22,83 -44,166 -66,249zm210 -232c0,0 0,0 0,0 -13,34 -26,68 -38,102 25,0 50,0 75,0 -12,-34 -24,-68 -37,-102zm36 190c11,0 22,0 33,0 -6,-15 -12,-29 -17,-44 -35,0 -70,0 -105,0 -5,15 -11,29 -17,44 11,0 22,0 32,0 0,14 0,28 0,42 -40,0 -80,0 -120,0 0,-16 0,-32 0,-48 10,0 21,0 31,0 29,-67 58,-134 86,-201 -11,0 -21,0 -32,0 0,-16 0,-32 0,-48 33,0 66,0 99,0 34,83 69,166 104,249 10,0 21,0 31,0 0,16 0,32 0,48 -41,0 -83,0 -125,0 0,-14 0,-28 0,-42zm201 -46c0,6 1,12 3,17 2,6 5,10 9,15 3,4 8,7 13,9 6,3 12,4 19,4 12,0 23,-4 31,-11 8,-7 12,-17 12,-30 0,-7 -1,-13 -4,-18 -4,-5 -8,-9 -13,-12 -4,-3 -10,-6 -16,-8 -6,-2 -12,-4 -17,-5 -11,-3 -21,-7 -31,-10 -9,-4 -18,-9 -27,-16 -22,-16 -33,-37 -33,-64 0,-13 3,-24 7,-35 5,-10 12,-19 20,-27 8,-7 18,-13 29,-18 11,-4 22,-6 34,-6 10,0 20,2 29,5 9,4 17,10 24,18 0,-6 0,-11 0,-17 14,0 28,0 43,0 0,27 0,53 0,80 -17,0 -34,0 -51,0 0,-11 -4,-20 -11,-28 -7,-7 -16,-11 -28,-11 -11,0 -20,4 -28,10 -8,7 -12,16 -12,27 0,7 2,13 5,18 2,5 6,9 11,12 5,3 10,5 16,7 5,2 11,4 17,5 11,3 22,7 33,11 10,3 21,9 30,16 10,8 17,17 22,28 5,10 8,22 8,34 0,14 -3,26 -7,37 -5,12 -12,22 -20,30 -8,8 -18,15 -30,19 -11,5 -24,7 -37,7 -12,0 -22,-2 -32,-6 -9,-4 -18,-10 -25,-19 0,7 0,13 0,20 -15,0 -30,0 -45,0 0,-30 0,-59 0,-88 17,0 35,0 52,0z"/>
37
+    <path fill="#B3B3B3" d="M423 708c-18,0 -36,0 -54,0 -18,-65 -36,-130 -55,-195 -18,65 -36,130 -55,195 -17,0 -35,0 -52,0 -24,-83 -48,-166 -71,-249 -10,0 -20,0 -30,0 0,-16 0,-31 0,-47 40,0 81,0 121,0 0,16 0,31 0,47 -11,0 -22,0 -33,0 14,52 28,104 42,156 18,-68 36,-136 54,-203 16,0 32,0 47,0 19,67 38,134 57,201 14,-51 27,-103 40,-154 -11,0 -22,0 -33,0 0,-16 0,-31 0,-47 40,0 80,0 120,0 0,16 0,31 0,47 -11,0 -21,0 -32,0 -22,83 -44,166 -66,249zm210 -231c-1,0 -1,0 -1,0 -12,34 -25,68 -38,102 26,0 51,0 76,0 -12,-34 -25,-68 -37,-102zm36 190c11,0 22,0 33,0 -6,-15 -12,-30 -18,-45 -35,0 -69,0 -104,0 -6,15 -11,30 -17,45 11,0 21,0 32,0 0,13 0,27 0,41 -40,0 -81,0 -121,0 0,-16 0,-31 0,-47 11,0 21,0 32,0 28,-67 57,-135 86,-202 -11,0 -22,0 -33,0 0,-16 0,-31 0,-47 33,0 66,0 99,0 35,83 70,166 104,249 11,0 21,0 32,0 0,16 0,31 0,47 -42,0 -84,0 -125,0 0,-14 0,-28 0,-41zm200 -47c0,6 1,12 3,18 2,5 5,10 9,14 4,4 8,8 14,10 5,2 11,3 18,3 13,0 23,-3 31,-10 9,-8 13,-18 13,-30 0,-8 -2,-14 -5,-19 -3,-5 -7,-9 -12,-12 -5,-3 -10,-6 -16,-7 -6,-2 -12,-4 -18,-6 -11,-3 -21,-6 -30,-10 -10,-3 -19,-8 -28,-15 -22,-16 -32,-38 -32,-65 0,-12 2,-23 7,-34 5,-10 11,-20 20,-27 8,-8 18,-14 28,-18 11,-4 22,-6 34,-6 11,0 20,1 30,5 9,4 17,9 23,17 0,-5 0,-11 0,-16 14,0 29,0 43,0 0,26 0,53 0,79 -17,0 -34,0 -50,0 -1,-11 -4,-20 -12,-27 -7,-7 -16,-11 -27,-11 -11,0 -21,3 -28,10 -8,6 -12,15 -12,27 0,7 1,13 4,18 3,4 7,8 12,11 4,3 9,6 15,8 6,1 11,3 17,5 12,3 23,6 34,10 10,4 20,10 30,17 9,7 17,17 22,27 5,11 7,23 7,35 0,13 -2,26 -7,37 -4,11 -11,21 -19,29 -9,9 -18,15 -30,20 -11,5 -24,7 -38,7 -11,0 -22,-2 -31,-6 -10,-4 -18,-10 -25,-19 0,6 0,13 0,19 -15,0 -30,0 -45,0 0,-29 0,-59 0,-88 17,0 34,0 51,0z"/>
38
+    <path fill="#AFAFAF" d="M422 708c-18,0 -36,0 -53,0 -19,-65 -37,-131 -55,-196 -18,65 -37,131 -55,196 -18,0 -35,0 -53,0 -23,-83 -47,-166 -71,-249 -10,0 -19,0 -29,0 0,-16 0,-32 0,-48 40,0 80,0 120,0 0,16 0,32 0,48 -11,0 -21,0 -32,0 14,52 28,103 42,155 18,-67 35,-135 53,-203 16,0 32,0 48,0 19,67 38,135 57,202 13,-52 26,-103 40,-154 -11,0 -22,0 -33,0 0,-16 0,-32 0,-48 40,0 80,0 120,0 0,16 0,32 0,48 -11,0 -22,0 -33,0 -22,83 -44,166 -66,249zm210 -232c0,0 0,0 0,0 -13,34 -25,68 -38,102 25,0 50,0 76,0 -13,-34 -25,-68 -38,-102zm36 190c11,0 22,0 33,0 -6,-15 -12,-29 -17,-44 -35,0 -70,0 -105,0 -5,15 -11,29 -17,44 11,0 22,0 32,0 0,14 0,28 0,42 -40,0 -80,0 -120,0 0,-16 0,-32 0,-48 10,0 21,0 31,0 29,-67 58,-134 86,-201 -10,0 -21,0 -32,0 0,-16 0,-32 0,-48 33,0 66,0 99,0 34,83 69,166 104,249 10,0 21,0 31,0 0,16 0,32 0,48 -41,0 -83,0 -125,0 0,-14 0,-28 0,-42zm201 -46c0,6 1,12 3,17 2,6 5,11 9,15 3,4 8,7 13,9 6,3 12,4 19,4 12,0 23,-4 31,-11 8,-7 12,-17 12,-30 0,-7 -1,-13 -4,-18 -4,-5 -8,-9 -12,-12 -5,-3 -11,-6 -17,-8 -6,-2 -11,-4 -17,-5 -11,-3 -21,-7 -31,-10 -9,-4 -18,-9 -27,-16 -22,-16 -33,-37 -33,-64 0,-13 3,-24 7,-34 5,-11 12,-20 20,-28 9,-7 18,-13 29,-17 11,-5 22,-7 34,-7 10,0 20,2 29,5 9,4 17,10 24,18 0,-6 0,-11 0,-17 14,0 28,0 43,0 0,27 0,53 0,80 -17,0 -34,0 -51,0 0,-11 -4,-20 -11,-28 -7,-7 -16,-11 -27,-11 -12,0 -21,4 -29,10 -8,7 -12,16 -12,27 0,8 2,13 5,18 3,5 6,9 11,12 5,3 10,5 16,7 5,2 11,4 17,5 11,3 23,7 33,11 11,4 21,9 30,16 10,8 17,17 22,28 5,11 8,22 8,35 0,13 -3,25 -7,36 -5,12 -11,22 -20,30 -8,8 -18,15 -29,19 -12,5 -24,8 -38,8 -12,0 -22,-3 -32,-7 -9,-4 -18,-10 -25,-19 0,7 0,13 0,20 -15,0 -30,0 -45,0 0,-30 0,-59 0,-88 17,0 35,0 52,0z"/>
39
+    <path fill="#ABABAB" d="M422 707c-18,0 -36,0 -54,0 -18,-65 -36,-130 -55,-195 -18,65 -36,130 -54,195 -18,0 -36,0 -53,0 -24,-83 -48,-166 -71,-249 -10,0 -20,0 -30,0 0,-16 0,-31 0,-47 40,0 81,0 121,0 0,16 0,31 0,47 -11,0 -22,0 -33,0 14,52 28,104 42,156 18,-68 36,-135 54,-203 16,0 32,0 48,0 19,67 37,134 56,201 14,-51 27,-103 40,-154 -11,0 -22,0 -33,0 0,-16 0,-31 0,-47 40,0 80,0 120,0 0,16 0,31 0,47 -10,0 -21,0 -32,0 -22,83 -44,166 -66,249zm210 -231c0,0 -1,0 -1,0 -12,34 -25,68 -37,102 25,0 50,0 75,0 -12,-34 -25,-68 -37,-102zm36 190c11,0 22,0 33,0 -6,-15 -12,-30 -18,-45 -35,0 -69,0 -104,0 -6,15 -11,30 -17,45 11,0 21,0 32,0 0,14 0,27 0,41 -40,0 -81,0 -121,0 0,-16 0,-31 0,-47 11,0 21,0 32,0 28,-67 57,-135 86,-202 -11,0 -22,0 -33,0 0,-16 0,-31 0,-47 33,0 66,0 99,0 35,83 70,166 104,249 11,0 21,0 32,0 0,16 0,31 0,47 -42,0 -84,0 -125,0 0,-14 0,-27 0,-41zm200 -47c0,6 1,12 3,18 2,5 5,10 9,14 4,4 8,8 14,10 5,2 11,3 18,3 13,0 23,-3 31,-10 9,-8 13,-17 13,-30 0,-8 -2,-14 -5,-19 -3,-5 -7,-9 -12,-12 -5,-3 -10,-5 -16,-7 -6,-2 -12,-4 -18,-6 -11,-3 -21,-6 -30,-10 -9,-3 -19,-8 -28,-15 -21,-16 -32,-38 -32,-65 0,-12 2,-23 7,-34 5,-10 11,-19 20,-27 8,-8 18,-14 28,-18 11,-4 23,-6 34,-6 11,0 20,1 30,5 9,4 17,9 23,17 0,-5 0,-11 0,-16 15,0 29,0 43,0 0,26 0,53 0,80 -17,0 -33,0 -50,0 -1,-12 -4,-21 -12,-28 -7,-7 -16,-11 -27,-11 -11,0 -20,3 -28,10 -8,6 -12,15 -12,27 0,7 1,13 4,18 3,4 7,8 12,11 4,3 9,6 15,8 6,1 12,3 17,5 12,3 23,6 34,10 10,4 20,10 30,17 10,8 17,17 22,27 5,11 7,23 7,35 0,13 -2,26 -7,37 -4,11 -11,21 -19,29 -9,9 -18,15 -30,20 -11,5 -24,7 -37,7 -12,0 -23,-2 -32,-6 -10,-4 -18,-10 -25,-19 0,6 0,13 0,19 -15,0 -30,0 -45,0 0,-29 0,-58 0,-88 17,0 34,0 51,0z"/>
40
+    <path fill="#A8A8A8" d="M421 707c-18,0 -36,0 -53,0 -19,-65 -37,-131 -55,-196 -18,65 -37,131 -55,196 -18,0 -35,0 -53,0 -23,-83 -47,-166 -71,-249 -9,0 -19,0 -29,0 0,-16 0,-32 0,-48 40,0 80,0 120,0 0,16 0,32 0,48 -11,0 -21,0 -32,0 14,52 28,103 42,155 18,-67 36,-135 53,-203 16,0 32,0 48,0 19,67 38,135 57,202 13,-52 27,-103 40,-154 -11,0 -22,0 -33,0 0,-16 0,-32 0,-48 40,0 80,0 120,0 0,16 0,32 0,48 -11,0 -22,0 -33,0 -22,83 -44,166 -66,249zm210 -231c0,0 0,0 0,0 -13,33 -25,67 -38,101 25,0 50,0 76,0 -13,-34 -25,-68 -38,-101zm36 189c11,0 22,0 33,0 -6,-15 -11,-29 -17,-44 -35,0 -70,0 -104,0 -6,15 -12,29 -18,44 11,0 22,0 32,0 0,14 0,28 0,42 -40,0 -80,0 -120,0 0,-16 0,-32 0,-48 10,0 21,0 31,0 29,-67 58,-134 87,-201 -11,0 -22,0 -33,0 0,-16 0,-32 0,-48 33,0 66,0 99,0 35,83 69,166 104,249 10,0 21,0 31,0 0,16 0,32 0,48 -41,0 -83,0 -125,0 0,-14 0,-28 0,-42zm201 -46c0,6 1,12 3,17 2,6 5,11 9,15 3,4 8,7 13,9 6,3 12,4 19,4 12,0 23,-4 31,-11 8,-7 12,-17 12,-30 0,-7 -1,-13 -4,-18 -4,-5 -8,-9 -12,-12 -5,-3 -11,-6 -17,-8 -6,-2 -11,-4 -17,-5 -11,-3 -21,-7 -31,-10 -9,-3 -18,-9 -27,-16 -22,-16 -33,-37 -33,-64 0,-13 3,-24 8,-34 4,-11 11,-20 19,-28 9,-7 18,-13 29,-17 11,-5 22,-7 34,-7 10,0 20,2 29,6 9,3 17,9 24,17 0,-6 0,-11 0,-17 14,0 28,0 43,0 0,27 0,54 0,80 -17,0 -34,0 -51,0 0,-11 -4,-20 -11,-28 -7,-7 -16,-11 -27,-11 -11,0 -21,4 -29,10 -8,7 -12,16 -12,27 0,8 2,14 5,18 3,5 6,9 11,12 5,3 10,5 16,7 5,2 11,4 17,5 12,3 23,7 33,11 11,4 21,9 30,16 10,8 17,17 22,28 5,11 8,22 8,35 0,13 -2,25 -7,37 -5,11 -11,21 -20,29 -8,8 -18,15 -29,20 -12,4 -24,7 -38,7 -12,0 -22,-2 -32,-6 -9,-4 -18,-11 -25,-20 0,7 0,13 0,20 -15,0 -30,0 -45,0 0,-30 0,-59 0,-88 18,0 35,0 52,0z"/>
41
+    <path fill="#A4A4A4" d="M421 706c-18,0 -36,0 -54,0 -18,-65 -36,-130 -55,-195 -18,65 -36,130 -54,195 -18,0 -36,0 -53,0 -24,-83 -47,-166 -71,-249 -10,0 -20,0 -30,0 0,-16 0,-31 0,-47 41,0 81,0 121,0 0,16 0,31 0,47 -11,0 -22,0 -33,0 14,52 28,104 42,156 18,-68 36,-135 54,-203 16,0 32,0 48,0 19,67 38,134 56,201 14,-51 27,-102 40,-154 -11,0 -22,0 -33,0 0,-16 0,-31 0,-47 40,0 80,0 121,0 0,16 0,31 0,47 -11,0 -22,0 -33,0 -22,83 -44,166 -66,249zm210 -231c0,0 -1,0 -1,0 -12,34 -25,68 -37,102 25,0 50,0 75,0 -12,-34 -25,-68 -37,-102zm36 190c11,0 22,0 33,0 -6,-15 -12,-30 -18,-45 -34,0 -69,0 -104,0 -6,15 -11,30 -17,45 11,0 21,0 32,0 0,14 0,27 0,41 -40,0 -81,0 -121,0 0,-15 0,-31 0,-47 11,0 21,0 32,0 29,-67 57,-135 86,-202 -11,0 -22,0 -33,0 0,-16 0,-31 0,-47 33,0 66,0 99,0 35,83 70,166 104,249 11,0 21,0 32,0 0,16 0,32 0,47 -42,0 -83,0 -125,0 0,-14 0,-27 0,-41zm200 -47c0,6 1,12 3,18 3,5 5,10 9,14 4,4 9,8 14,10 5,2 11,4 18,4 13,0 23,-4 32,-11 8,-7 12,-17 12,-30 0,-8 -2,-14 -5,-19 -3,-4 -7,-8 -12,-12 -5,-3 -10,-5 -16,-7 -6,-2 -12,-4 -18,-6 -10,-3 -21,-6 -30,-9 -9,-4 -19,-9 -28,-16 -21,-16 -32,-38 -32,-65 0,-12 2,-23 7,-34 5,-10 12,-19 20,-27 8,-8 18,-14 28,-18 11,-4 23,-6 34,-6 11,0 20,1 30,5 9,4 17,9 23,18 0,-6 0,-12 0,-17 15,0 29,0 43,0 0,26 0,53 0,80 -17,0 -33,0 -50,0 -1,-11 -4,-21 -11,-28 -8,-7 -17,-11 -28,-11 -11,0 -20,3 -28,10 -8,6 -12,15 -12,27 0,7 1,13 4,18 3,4 7,8 12,11 4,3 10,6 15,8 6,1 12,3 17,5 12,3 23,6 34,10 10,4 20,10 30,17 10,8 17,17 22,27 5,11 7,23 7,35 0,13 -2,26 -7,37 -4,11 -11,21 -19,30 -8,8 -18,14 -30,19 -11,5 -24,7 -37,7 -12,0 -23,-2 -32,-6 -10,-4 -18,-10 -25,-19 0,6 0,13 0,19 -15,0 -30,0 -45,0 0,-29 0,-58 0,-88 17,0 34,0 51,0z"/>
42
+    <path fill="#A1A1A1" d="M420 706c-18,0 -35,0 -53,0 -19,-65 -37,-131 -55,-196 -18,65 -37,131 -55,196 -17,0 -35,0 -53,0 -23,-83 -47,-166 -71,-249 -9,0 -19,0 -29,0 0,-16 0,-32 0,-48 40,0 80,0 120,0 0,16 0,32 0,48 -10,0 -21,0 -32,0 14,52 28,104 42,155 18,-67 36,-135 53,-203 16,0 32,0 48,0 19,68 38,135 57,202 13,-52 27,-103 40,-154 -11,0 -22,0 -33,0 0,-16 0,-32 0,-48 40,0 80,0 120,0 0,16 0,32 0,48 -11,0 -22,0 -33,0 -22,83 -44,166 -66,249zm210 -231c0,0 0,0 0,0 -13,34 -25,67 -38,101 25,0 50,0 76,0 -13,-34 -25,-67 -38,-101zm36 189c11,0 22,0 33,0 -6,-14 -11,-29 -17,-44 -35,0 -70,0 -104,0 -6,15 -12,30 -17,44 10,0 21,0 32,0 0,14 0,28 0,42 -41,0 -81,0 -121,0 0,-16 0,-32 0,-47 10,0 21,0 31,0 29,-68 58,-135 87,-202 -11,0 -22,0 -33,0 0,-16 0,-32 0,-48 33,0 66,0 99,0 35,83 69,166 104,250 10,0 21,0 31,0 0,15 0,31 0,47 -41,0 -83,0 -125,0 0,-14 0,-28 0,-42zm201 -46c0,6 1,12 3,17 2,6 5,11 9,15 3,4 8,7 13,10 6,2 12,3 19,3 12,0 23,-4 31,-11 8,-7 12,-17 12,-30 0,-7 -1,-13 -4,-18 -3,-5 -7,-9 -12,-12 -5,-3 -11,-6 -17,-8 -5,-2 -11,-4 -17,-5 -11,-3 -21,-6 -30,-10 -10,-3 -19,-9 -28,-16 -22,-16 -33,-37 -33,-64 0,-12 3,-24 8,-34 4,-11 11,-20 19,-27 9,-8 18,-14 29,-18 11,-5 22,-7 34,-7 10,0 20,2 29,6 10,3 17,9 24,17 0,-5 0,-11 0,-17 14,0 29,0 43,0 0,27 0,54 0,80 -17,0 -34,0 -51,0 0,-11 -4,-20 -11,-27 -7,-8 -16,-11 -27,-11 -11,0 -21,3 -29,9 -8,7 -12,16 -12,27 0,8 2,14 5,18 3,5 6,9 11,12 5,3 10,5 16,7 5,2 11,4 17,5 12,3 23,7 33,11 11,4 21,9 30,16 10,8 17,17 22,28 5,11 8,22 8,35 0,13 -2,25 -7,37 -5,11 -11,21 -20,29 -8,8 -18,15 -29,20 -12,4 -24,7 -38,7 -11,0 -22,-2 -32,-6 -9,-4 -18,-11 -25,-20 0,7 0,13 0,20 -15,0 -30,0 -45,0 0,-30 0,-59 0,-88 18,0 35,0 52,0z"/>
43
+    <path fill="#9D9D9D" d="M420 705c-18,0 -36,0 -54,0 -18,-65 -36,-130 -55,-195 -18,65 -36,130 -54,195 -18,0 -35,0 -53,0 -24,-83 -47,-166 -71,-249 -10,0 -20,0 -30,0 0,-15 0,-31 0,-47 41,0 81,0 121,0 0,16 0,32 0,47 -11,0 -22,0 -33,0 14,52 28,104 42,156 18,-68 36,-135 54,-203 16,0 32,0 48,0 19,67 38,134 57,201 13,-51 26,-102 39,-154 -11,0 -22,0 -33,0 0,-15 0,-31 0,-47 40,0 80,0 121,0 0,16 0,32 0,47 -11,0 -22,0 -33,0 -22,83 -44,166 -66,249zm210 -231c0,0 0,0 -1,0 -12,34 -25,68 -37,102 25,0 50,0 75,0 -12,-34 -25,-68 -37,-102zm36 190c11,0 22,0 33,0 -6,-15 -12,-30 -18,-45 -34,0 -69,0 -104,0 -6,15 -11,30 -17,45 11,0 21,0 32,0 0,14 0,28 0,41 -40,0 -80,0 -121,0 0,-15 0,-31 0,-47 11,0 21,0 32,0 29,-67 57,-134 86,-202 -11,0 -22,0 -33,0 0,-15 0,-31 0,-47 33,0 66,0 100,0 34,83 69,166 103,249 11,0 21,0 32,0 0,16 0,32 0,47 -42,0 -83,0 -125,0 0,-13 0,-27 0,-41zm200 -47c0,6 1,12 4,18 2,5 5,10 8,14 4,4 9,8 14,10 5,2 12,4 18,4 13,0 23,-4 32,-11 8,-7 12,-17 12,-30 0,-8 -2,-14 -5,-19 -3,-4 -7,-8 -12,-12 -5,-3 -10,-5 -16,-7 -6,-2 -12,-4 -18,-6 -10,-3 -21,-6 -30,-9 -9,-4 -19,-9 -28,-16 -21,-16 -32,-38 -32,-65 0,-12 2,-23 7,-34 5,-10 12,-19 20,-27 8,-8 18,-14 29,-18 10,-4 22,-6 34,-6 10,0 20,2 29,5 9,4 17,10 23,18 0,-6 0,-11 0,-17 15,0 29,0 43,0 0,27 0,53 0,80 -16,0 -33,0 -50,0 0,-11 -4,-21 -11,-28 -8,-7 -17,-11 -28,-11 -11,0 -20,3 -28,10 -8,6 -12,15 -12,27 0,7 1,13 4,18 3,5 7,8 12,11 4,4 10,6 15,8 6,2 12,3 17,5 12,3 23,6 34,10 10,4 20,10 30,17 10,8 17,17 22,28 5,10 7,22 7,34 0,13 -2,26 -7,37 -4,11 -11,21 -19,30 -8,8 -18,14 -30,19 -11,5 -24,7 -37,7 -12,0 -23,-2 -32,-6 -10,-4 -18,-10 -25,-19 0,6 0,13 0,19 -15,0 -30,0 -45,0 0,-29 0,-58 0,-88 17,0 34,0 51,0z"/>
44
+    <path fill="#999999" d="M419 705c-18,0 -35,0 -53,0 -18,-65 -37,-130 -55,-196 -18,66 -37,131 -55,196 -17,0 -35,0 -53,0 -23,-83 -47,-166 -71,-249 -9,0 -19,0 -29,0 0,-16 0,-32 0,-47 40,0 80,0 120,0 0,15 0,31 0,47 -10,0 -21,0 -32,0 14,52 28,104 42,155 18,-67 36,-135 53,-202 16,0 32,0 48,0 19,67 38,134 57,201 13,-52 27,-103 40,-154 -11,0 -22,0 -33,0 0,-16 0,-32 0,-47 40,0 80,0 120,0 0,15 0,31 0,47 -11,0 -22,0 -33,0 -22,83 -44,166 -66,249zm210 -231c0,0 0,0 0,0 -13,34 -25,67 -38,101 25,0 51,0 76,0 -13,-34 -25,-67 -38,-101zm36 189c11,0 22,0 33,0 -6,-14 -11,-29 -17,-44 -35,0 -70,0 -104,0 -6,15 -12,30 -17,44 10,0 21,0 32,0 0,14 0,28 0,42 -41,0 -81,0 -121,0 0,-16 0,-32 0,-47 10,0 21,0 31,0 29,-68 58,-135 87,-202 -11,0 -22,0 -33,0 0,-16 0,-32 0,-47 33,0 66,0 99,0 35,83 69,166 104,249 10,0 21,0 31,0 0,15 0,31 0,47 -41,0 -83,0 -125,0 0,-14 0,-28 0,-42zm201 -46c0,6 1,12 3,17 2,6 5,11 9,15 4,4 8,7 13,10 6,2 12,3 19,3 12,0 23,-3 31,-11 8,-7 13,-17 13,-30 0,-7 -2,-13 -5,-18 -3,-5 -7,-9 -12,-12 -5,-3 -10,-6 -16,-8 -6,-2 -12,-3 -18,-5 -11,-3 -21,-6 -30,-10 -10,-3 -19,-9 -28,-15 -22,-17 -33,-38 -33,-65 0,-12 3,-24 8,-34 5,-11 11,-20 19,-27 9,-8 18,-14 29,-18 11,-5 22,-7 34,-7 10,0 20,2 29,6 10,3 17,9 24,17 0,-5 0,-11 0,-16 14,0 29,0 43,0 0,26 0,53 0,79 -17,0 -34,0 -51,0 0,-11 -4,-20 -11,-27 -7,-8 -16,-11 -27,-11 -11,0 -21,3 -29,9 -8,7 -12,16 -12,28 0,7 2,13 5,17 3,5 7,9 11,12 5,3 10,5 16,7 5,2 11,4 17,5 12,4 23,7 33,11 11,4 21,9 31,16 9,8 17,17 22,28 5,11 7,22 7,35 0,13 -2,25 -7,37 -5,11 -11,21 -20,29 -8,8 -18,15 -29,20 -12,4 -24,7 -38,7 -11,0 -22,-2 -32,-6 -9,-4 -17,-11 -25,-20 0,7 0,13 0,20 -15,0 -30,0 -45,0 0,-29 0,-59 0,-88 18,0 35,0 52,0z"/>
45
+    <path fill="#969696" d="M419 704c-18,0 -36,0 -54,0 -18,-65 -36,-130 -54,-195 -19,65 -37,130 -55,195 -18,0 -35,0 -53,0 -24,-83 -47,-166 -71,-249 -10,0 -20,0 -29,0 0,-15 0,-31 0,-47 40,0 80,0 120,0 0,16 0,32 0,47 -11,0 -22,0 -32,0 14,52 27,104 41,156 18,-68 36,-135 54,-203 16,0 32,0 48,0 19,67 38,134 57,201 13,-51 26,-102 39,-154 -11,0 -22,0 -33,0 0,-15 0,-31 0,-47 40,0 81,0 121,0 0,16 0,32 0,47 -11,0 -22,0 -33,0 -22,83 -44,166 -66,249zm210 -231c0,0 0,0 -1,0 -12,34 -25,68 -37,102 25,0 50,0 75,0 -12,-34 -25,-68 -37,-102zm36 190c11,0 22,0 33,0 -6,-15 -12,-30 -18,-44 -34,0 -69,0 -104,0 -5,14 -11,29 -17,44 11,0 21,0 32,0 0,14 0,28 0,41 -40,0 -80,0 -121,0 0,-15 0,-31 0,-47 11,0 21,0 32,0 29,-67 57,-134 86,-202 -11,0 -22,0 -33,0 0,-15 0,-31 0,-47 33,0 67,0 100,0 34,83 69,166 103,249 11,0 21,0 32,0 0,16 0,32 0,47 -42,0 -83,0 -125,0 0,-13 0,-27 0,-41zm201 -47c0,7 1,12 3,18 2,5 5,10 8,14 4,5 9,8 14,10 5,2 12,4 19,4 12,0 22,-4 31,-11 8,-7 12,-17 12,-30 0,-7 -1,-14 -5,-18 -3,-5 -7,-9 -12,-13 -5,-3 -10,-5 -16,-7 -6,-2 -12,-4 -18,-6 -10,-3 -20,-6 -30,-9 -9,-4 -19,-9 -28,-16 -21,-16 -32,-38 -32,-65 0,-12 2,-23 7,-34 5,-10 12,-19 20,-27 8,-8 18,-13 29,-18 10,-4 22,-6 34,-6 10,0 20,2 29,5 9,4 17,10 23,18 0,-6 0,-11 0,-17 15,0 29,0 44,0 0,27 0,53 0,80 -17,0 -34,0 -51,0 0,-11 -4,-21 -11,-28 -8,-7 -17,-11 -28,-11 -11,0 -20,3 -28,10 -8,6 -12,15 -12,27 0,7 1,13 4,18 3,5 7,9 12,12 4,3 10,5 15,7 6,2 12,3 18,5 11,3 22,7 33,10 10,4 20,10 30,17 10,8 17,17 22,28 5,10 8,22 8,34 0,14 -3,26 -8,37 -4,12 -11,21 -19,30 -8,8 -18,14 -30,19 -11,5 -24,7 -37,7 -12,0 -22,-2 -32,-6 -10,-4 -18,-10 -25,-19 0,6 0,13 0,19 -15,0 -30,0 -45,0 0,-29 0,-58 0,-88 17,0 34,0 52,0z"/>
46
+    <path fill="#929292" d="M418 704c-17,0 -35,0 -53,0 -18,-65 -37,-130 -55,-196 -18,66 -36,131 -55,196 -17,0 -35,0 -52,0 -24,-83 -48,-166 -71,-249 -10,0 -20,0 -30,0 0,-16 0,-32 0,-47 40,0 80,0 120,0 0,15 0,31 0,47 -10,0 -21,0 -32,0 14,52 28,104 42,156 18,-68 36,-136 54,-203 15,0 31,0 47,0 19,67 38,134 57,201 13,-51 27,-103 40,-154 -11,0 -22,0 -33,0 0,-16 0,-32 0,-47 40,0 80,0 120,0 0,15 0,31 0,47 -11,0 -22,0 -33,0 -22,83 -44,166 -66,249zm210 -231c0,0 0,0 0,0 -13,34 -25,68 -38,101 25,0 51,0 76,0 -13,-33 -25,-67 -38,-101zm37 189c10,0 21,0 32,0 -5,-14 -11,-29 -17,-44 -35,0 -70,0 -104,0 -6,15 -12,30 -17,44 10,0 21,0 32,0 0,14 0,28 0,42 -41,0 -81,0 -121,0 0,-16 0,-32 0,-47 10,0 21,0 31,0 29,-68 58,-135 87,-202 -11,0 -22,0 -33,0 0,-16 0,-32 0,-47 33,0 66,0 99,0 35,83 69,166 104,249 10,0 21,0 31,0 0,15 0,31 0,47 -41,0 -83,0 -124,0 0,-14 0,-28 0,-42zm200 -46c0,6 1,12 3,17 2,6 5,11 9,15 4,4 8,7 14,10 5,2 11,3 18,3 12,0 23,-3 31,-11 8,-7 13,-17 13,-29 0,-8 -2,-14 -5,-19 -3,-5 -7,-9 -12,-12 -5,-3 -10,-6 -16,-8 -6,-2 -12,-3 -18,-5 -11,-3 -21,-6 -30,-10 -10,-3 -19,-8 -28,-15 -22,-16 -33,-38 -33,-65 0,-12 3,-24 8,-34 5,-11 11,-20 19,-27 9,-8 18,-14 29,-18 11,-5 22,-7 34,-7 10,0 20,2 29,6 10,3 18,9 24,17 0,-5 0,-11 0,-16 14,0 29,0 43,0 0,26 0,53 0,79 -17,0 -34,0 -51,0 0,-11 -4,-20 -11,-27 -7,-8 -16,-11 -27,-11 -11,0 -21,3 -29,9 -8,7 -11,16 -11,28 0,7 1,13 4,17 3,5 7,9 11,12 5,3 10,6 16,7 6,2 11,4 17,6 12,3 23,6 33,10 11,4 21,9 31,17 9,7 17,16 22,27 5,11 7,22 7,35 0,13 -2,25 -7,37 -5,11 -11,21 -19,29 -9,9 -19,15 -30,20 -12,4 -24,7 -38,7 -11,0 -22,-2 -31,-6 -10,-4 -18,-11 -26,-20 0,7 0,13 0,20 -15,0 -29,0 -44,0 0,-29 0,-59 0,-88 17,0 34,0 51,0z"/>
47
+    <path fill="#8E8E8E" d="M418 703c-18,0 -36,0 -54,0 -18,-65 -36,-130 -54,-195 -19,65 -37,130 -55,195 -18,0 -35,0 -53,0 -24,-83 -47,-166 -71,-249 -10,0 -20,0 -29,0 0,-15 0,-31 0,-47 40,0 80,0 120,0 0,16 0,32 0,47 -11,0 -22,0 -32,0 14,52 28,104 42,156 17,-68 35,-135 53,-203 16,0 32,0 48,0 19,67 38,134 57,201 13,-51 26,-102 40,-154 -12,0 -23,0 -34,0 0,-15 0,-31 0,-47 40,0 81,0 121,0 0,16 0,32 0,47 -11,0 -22,0 -33,0 -22,83 -44,166 -66,249zm210 -231c0,0 0,0 0,0 -13,34 -26,68 -38,102 25,0 50,0 75,0 -12,-34 -25,-68 -37,-102zm36 190c11,0 22,0 33,0 -6,-15 -12,-30 -18,-44 -34,0 -69,0 -104,0 -5,14 -11,29 -17,44 11,0 22,0 32,0 0,14 0,28 0,41 -40,0 -80,0 -121,0 0,-15 0,-31 0,-47 11,0 21,0 32,0 29,-67 57,-134 86,-202 -11,0 -22,0 -33,0 0,-15 0,-31 0,-47 34,0 67,0 100,0 34,83 69,166 103,249 11,0 22,0 32,0 0,16 0,32 0,47 -42,0 -83,0 -125,0 0,-13 0,-27 0,-41zm201 -47c0,7 1,12 3,18 2,5 5,10 8,14 4,5 9,8 14,10 5,3 12,4 19,4 12,0 22,-4 31,-11 8,-7 12,-17 12,-30 0,-7 -1,-14 -5,-18 -3,-5 -7,-9 -12,-12 -4,-4 -10,-6 -16,-8 -6,-2 -12,-4 -17,-6 -11,-3 -21,-6 -31,-9 -9,-4 -18,-9 -28,-16 -21,-16 -32,-37 -32,-65 0,-12 2,-23 7,-34 5,-10 12,-19 20,-27 8,-7 18,-13 29,-18 10,-4 22,-6 34,-6 10,0 20,2 29,5 9,4 17,10 23,18 0,-6 0,-11 0,-17 15,0 29,0 44,0 0,27 0,53 0,80 -17,0 -34,0 -51,0 0,-11 -4,-20 -11,-28 -7,-7 -17,-11 -28,-11 -11,0 -20,3 -28,10 -8,6 -12,16 -12,27 0,7 2,13 4,18 3,5 7,9 12,12 5,3 10,5 15,7 6,2 12,3 18,5 11,3 22,7 33,10 10,4 20,10 30,17 10,8 17,17 22,28 5,10 8,22 8,34 0,14 -3,26 -7,37 -5,12 -12,21 -20,30 -8,8 -18,15 -30,19 -11,5 -24,7 -37,7 -12,0 -22,-2 -32,-6 -10,-4 -18,-10 -25,-19 0,6 0,13 0,19 -15,0 -30,0 -45,0 0,-29 0,-58 0,-88 17,0 34,0 52,0z"/>
48
+    <path fill="#8B8B8B" d="M417 703c-17,0 -35,0 -53,0 -18,-65 -37,-130 -55,-195 -18,65 -36,130 -55,195 -17,0 -35,0 -52,0 -24,-83 -48,-166 -71,-249 -10,0 -20,0 -30,0 0,-16 0,-32 0,-47 40,0 80,0 121,0 0,15 0,31 0,47 -11,0 -22,0 -33,0 14,52 28,104 42,156 18,-68 36,-136 54,-203 16,0 31,0 47,0 19,67 38,134 57,201 14,-51 27,-103 40,-154 -11,0 -22,0 -33,0 0,-16 0,-32 0,-47 40,0 80,0 120,0 0,15 0,31 0,47 -11,0 -22,0 -33,0 -22,83 -44,166 -66,249zm210 -231c0,0 0,0 0,0 -13,34 -25,68 -38,102 25,0 51,0 76,0 -13,-34 -25,-68 -38,-102zm37 190c11,0 21,0 32,0 -5,-15 -11,-30 -17,-45 -35,0 -69,0 -104,0 -6,15 -12,30 -17,45 10,0 21,0 32,0 0,13 0,27 0,41 -41,0 -81,0 -121,0 0,-16 0,-32 0,-47 10,0 21,0 31,0 29,-68 58,-135 87,-202 -11,0 -22,0 -33,0 0,-16 0,-32 0,-47 33,0 66,0 99,0 35,83 69,166 104,249 11,0 21,0 32,0 0,15 0,31 0,47 -42,0 -84,0 -125,0 0,-14 0,-28 0,-41zm200 -47c0,6 1,12 3,17 2,6 5,11 9,15 4,4 8,7 14,10 5,2 11,3 18,3 13,0 23,-3 31,-11 9,-7 13,-17 13,-29 0,-8 -2,-14 -5,-19 -3,-5 -7,-9 -12,-12 -5,-3 -10,-6 -16,-8 -6,-2 -12,-3 -18,-5 -11,-3 -21,-6 -30,-10 -10,-3 -19,-8 -28,-15 -22,-16 -32,-38 -32,-65 0,-12 2,-24 7,-34 5,-11 11,-20 20,-27 8,-8 17,-14 28,-18 11,-4 22,-7 34,-7 10,0 20,2 29,6 10,3 18,9 24,17 0,-5 0,-11 0,-16 14,0 29,0 43,0 0,26 0,53 0,79 -17,0 -34,0 -51,0 0,-11 -4,-20 -11,-27 -7,-8 -16,-11 -27,-11 -11,0 -21,3 -29,9 -7,7 -11,16 -11,28 0,7 1,13 4,18 3,4 7,8 11,11 5,3 10,6 16,7 6,2 11,4 17,6 12,3 23,6 33,10 11,4 21,9 31,17 9,7 17,17 22,27 5,11 7,22 7,35 0,13 -2,25 -7,37 -5,11 -11,21 -19,29 -9,9 -19,15 -30,20 -12,4 -24,7 -38,7 -11,0 -22,-2 -31,-6 -10,-4 -18,-11 -26,-19 0,6 0,13 0,19 -14,0 -29,0 -44,0 0,-29 0,-59 0,-88 17,0 34,0 51,0z"/>
49
+    <path fill="#878787" d="M417 703c-18,0 -36,0 -54,0 -18,-66 -36,-131 -54,-196 -19,65 -37,130 -55,196 -18,0 -35,0 -53,0 -24,-83 -47,-166 -71,-250 -10,0 -19,0 -29,0 0,-15 0,-31 0,-47 40,0 80,0 120,0 0,16 0,32 0,47 -11,0 -22,0 -32,0 14,52 28,104 42,156 17,-68 35,-135 53,-203 16,0 32,0 48,0 19,67 38,134 57,201 13,-51 26,-102 40,-154 -11,0 -23,0 -34,0 0,-15 0,-31 0,-47 41,0 81,0 121,0 0,16 0,32 0,47 -11,0 -22,0 -33,0 -22,84 -44,167 -66,250zm210 -232c0,0 0,0 0,0 -13,34 -26,68 -38,102 25,0 50,0 75,0 -12,-34 -25,-68 -37,-102zm36 190c11,0 22,0 33,0 -6,-15 -12,-30 -18,-44 -34,0 -69,0 -104,0 -5,14 -11,29 -17,44 11,0 22,0 32,0 0,14 0,28 0,42 -40,0 -80,0 -121,0 0,-16 0,-32 0,-48 11,0 21,0 32,0 29,-67 58,-134 86,-202 -11,0 -22,0 -32,0 0,-15 0,-31 0,-47 33,0 66,0 99,0 34,83 69,166 104,249 10,0 21,0 31,0 0,16 0,32 0,48 -42,0 -83,0 -125,0 0,-14 0,-28 0,-42zm201 -46c0,6 1,11 3,17 2,6 5,10 8,15 4,4 9,7 14,9 6,3 12,4 19,4 12,0 22,-4 31,-11 8,-7 12,-17 12,-30 0,-7 -1,-14 -5,-18 -3,-5 -7,-9 -12,-12 -4,-4 -10,-6 -16,-8 -6,-2 -12,-4 -17,-5 -11,-4 -21,-7 -31,-10 -9,-4 -18,-9 -28,-16 -21,-16 -32,-37 -32,-65 0,-12 3,-23 7,-34 5,-10 12,-19 20,-27 8,-7 18,-13 29,-18 11,-4 22,-6 34,-6 10,0 20,2 29,5 9,4 17,10 23,18 0,-6 0,-11 0,-17 15,0 29,0 44,0 0,27 0,53 0,80 -17,0 -34,0 -51,0 0,-11 -4,-20 -11,-28 -7,-7 -17,-11 -28,-11 -11,0 -20,4 -28,10 -8,7 -12,16 -12,27 0,7 2,13 4,18 3,5 7,9 12,12 5,3 10,5 15,7 6,2 12,3 18,5 11,3 22,7 33,11 10,3 21,9 30,16 10,8 17,17 22,28 5,10 8,22 8,34 0,14 -3,26 -7,37 -5,12 -12,21 -20,30 -8,8 -18,15 -30,19 -11,5 -24,7 -37,7 -12,0 -22,-2 -32,-6 -9,-4 -18,-10 -25,-19 0,7 0,13 0,20 -15,0 -30,0 -45,0 0,-30 0,-59 0,-88 17,0 34,0 52,0z"/>
50
+    <path fill="#848484" d="M417 702c-18,0 -36,0 -54,0 -18,-65 -37,-130 -55,-195 -18,65 -36,130 -55,195 -17,0 -35,0 -52,0 -24,-83 -48,-166 -71,-249 -10,0 -20,0 -30,0 0,-16 0,-32 0,-47 40,0 80,0 121,0 0,15 0,31 0,47 -11,0 -22,0 -33,0 14,52 28,104 42,156 18,-68 36,-136 54,-203 16,0 32,0 47,0 19,67 38,134 57,201 14,-51 27,-103 40,-154 -11,0 -22,0 -33,0 0,-16 0,-32 0,-47 40,0 80,0 120,0 0,15 0,31 0,47 -11,0 -22,0 -32,0 -22,83 -44,166 -66,249zm210 -231c-1,0 -1,0 -1,0 -12,34 -25,68 -38,102 26,0 51,0 76,0 -13,-34 -25,-68 -37,-102zm36 190c11,0 22,0 32,0 -5,-15 -11,-30 -17,-45 -35,0 -69,0 -104,0 -6,15 -12,30 -17,45 10,0 21,0 32,0 0,13 0,27 0,41 -40,0 -81,0 -121,0 0,-16 0,-31 0,-47 11,0 21,0 32,0 28,-67 57,-135 86,-202 -11,0 -22,0 -33,0 0,-16 0,-32 0,-47 33,0 66,0 99,0 35,83 69,166 104,249 11,0 21,0 32,0 0,16 0,31 0,47 -42,0 -84,0 -125,0 0,-14 0,-28 0,-41zm200 -47c0,6 1,12 3,18 2,5 5,10 9,14 4,4 8,7 14,10 5,2 11,3 18,3 13,0 23,-3 31,-10 9,-8 13,-18 13,-30 0,-8 -2,-14 -5,-19 -3,-5 -7,-9 -12,-12 -5,-3 -10,-6 -16,-8 -6,-1 -12,-3 -18,-5 -11,-3 -21,-6 -30,-10 -10,-3 -19,-8 -28,-15 -22,-16 -32,-38 -32,-65 0,-12 2,-24 7,-34 5,-11 11,-20 20,-27 8,-8 17,-14 28,-18 11,-4 22,-7 34,-7 11,0 20,2 30,6 9,3 17,9 23,17 0,-5 0,-11 0,-16 14,0 29,0 43,0 0,26 0,53 0,79 -17,0 -34,0 -50,0 -1,-11 -4,-20 -12,-27 -7,-8 -16,-11 -27,-11 -11,0 -21,3 -29,10 -7,6 -11,15 -11,27 0,7 1,13 4,18 3,4 7,8 11,11 5,3 10,6 16,7 6,2 11,4 17,6 12,3 23,6 33,10 11,4 21,9 31,17 9,7 17,17 22,27 5,11 7,22 7,35 0,13 -2,26 -7,37 -5,11 -11,21 -19,29 -9,9 -19,15 -30,20 -12,5 -24,7 -38,7 -11,0 -22,-2 -31,-6 -10,-4 -18,-11 -25,-19 0,6 0,13 0,19 -15,0 -30,0 -45,0 0,-29 0,-59 0,-88 17,0 34,0 51,0z"/>
51
+   </g>
52
+   <path fill="gray" fill-rule="nonzero" d="M416 702l-54 0 -54 -196 -55 196 -53 0 -71 -249 -29 0 0 -48 120 0 0 48 -32 0 42 155 53 -203 48 0 57 202 40 -154 -34 0 0 -48 121 0 0 48 -33 0 -66 249zm210 -232l0 0 -38 102 75 0 -37 -102zm36 190l33 0 -17 -44 -105 0 -17 44 32 0 0 42 -120 0 0 -48 31 0 86 -201 -32 0 0 -48 99 0 104 249 31 0 0 48 -125 0 0 -42zm201 -46c0,6 1,12 3,17 2,6 5,10 9,15 3,4 8,7 13,9 6,3 12,4 19,4 12,0 23,-4 31,-11 8,-7 12,-17 12,-30 0,-7 -1,-13 -4,-18 -4,-5 -8,-9 -13,-12 -4,-3 -10,-6 -16,-8 -6,-2 -12,-4 -17,-5 -11,-3 -21,-7 -31,-10 -9,-4 -18,-9 -27,-16 -22,-16 -33,-37 -33,-64 0,-13 3,-24 7,-35 5,-10 12,-19 20,-27 8,-7 18,-13 29,-18 11,-4 22,-6 34,-6 10,0 20,2 29,5 9,4 17,10 24,18l0 -17 43 0 0 80 -51 0c0,-11 -4,-20 -11,-28 -7,-7 -16,-11 -28,-11 -11,0 -20,4 -28,10 -8,7 -12,16 -12,27 0,7 2,13 5,18 2,5 6,9 11,12 5,3 10,5 16,7 5,2 11,4 17,5 11,3 22,7 33,11 10,3 21,9 30,16 10,8 17,17 22,28 5,10 8,22 8,34 0,14 -3,26 -7,37 -5,12 -12,22 -20,30 -8,8 -18,15 -30,19 -11,5 -24,7 -37,7 -12,0 -22,-2 -32,-6 -9,-4 -18,-10 -25,-19l0 20 -45 0 0 -88 52 0z"/>
53
+   <path fill="white" fill-rule="nonzero" d="M416 702l-54 0 -54 -196 -55 196 -53 0 -71 -249 -29 0 0 -48 120 0 0 48 -32 0 42 155 53 -203 48 0 57 202 40 -154 -34 0 0 -48 121 0 0 48 -33 0 -66 249zm210 -232l0 0 -38 102 75 0 -37 -102zm36 190l33 0 -17 -44 -105 0 -17 44 32 0 0 42 -120 0 0 -48 31 0 86 -201 -32 0 0 -48 99 0 104 249 31 0 0 48 -125 0 0 -42zm201 -46c0,6 1,12 3,17 2,6 5,10 9,15 3,4 8,7 13,9 6,3 12,4 19,4 12,0 23,-4 31,-11 8,-7 12,-17 12,-30 0,-7 -1,-13 -4,-18 -4,-5 -8,-9 -13,-12 -4,-3 -10,-6 -16,-8 -6,-2 -12,-4 -17,-5 -11,-3 -21,-7 -31,-10 -9,-4 -18,-9 -27,-16 -22,-16 -33,-37 -33,-64 0,-13 3,-24 7,-35 5,-10 12,-19 20,-27 8,-7 18,-13 29,-18 11,-4 22,-6 34,-6 10,0 20,2 29,5 9,4 17,10 24,18l0 -17 43 0 0 80 -51 0c0,-11 -4,-20 -11,-28 -7,-7 -16,-11 -28,-11 -11,0 -20,4 -28,10 -8,7 -12,16 -12,27 0,7 2,13 5,18 2,5 6,9 11,12 5,3 10,5 16,7 5,2 11,4 17,5 11,3 22,7 33,11 10,3 21,9 30,16 10,8 17,17 22,28 5,10 8,22 8,34 0,14 -3,26 -7,37 -5,12 -12,22 -20,30 -8,8 -18,15 -30,19 -11,5 -24,7 -37,7 -12,0 -22,-2 -32,-6 -9,-4 -18,-10 -25,-19l0 20 -45 0 0 -88 52 0z"/>
54
+  </g>
55
+ </g>
56
+</svg>
Back to file index

index.html

 1
--- 
 2
+++ index.html
 3
@@ -0,0 +1,7 @@
 4
+<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en-IN"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>Google</title><script>(function(){window.google={kEI:'e1q9V5eIEMjivgSjuqD4BQ',kEXPI:'1351587,3700274,3700389,4029815,4031109,4032678,4036509,4036527,4038012,4039268,4041302,4043492,4045841,4048346,4054590,4061155,4061922,4062702,4062706,4063879,4064815,4065787,4065793,4065959,4066195,4066654,4066708,4067175,4067860,4067939,4068550,4069839,4069841,4069904,4070060,4070221,4070455,4070598,4071020,4071229,4071577,4071603,4071842,4072000,4072213,4072288,4072364,4072579,4072624,4072653,4072682,4072776,4073231,4073249,4073405,4073418,4073889,4073958,4073979,4074348,4074559,4074800,4074801,4075122,4075451,4075720,4075782,4075787,4075860,4075966,4075974,4076096,4076116,4076744,4077218,4077221,8300096,8300272,8502184,8503585,8504846,8505150,8505152,8505585,8505677,10200083,16200026',authuser:0,kscs:'c9c918f0_24'};google.kHL='en-IN';})();(function(){google.lc=[];google.li=0;google.getEI=function(a){for(var b;a&&(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||google.kEI};google.getLEI=function(a){for(var b=null;a&&(!a.getAttribute||!(b=a.getAttribute("leid")));)a=a.parentNode;return b};google.https=function(){return"https:"==window.location.protocol};google.ml=function(){return null};google.wl=function(a,b){try{google.ml(Error(a),!1,b)}catch(c){}};google.time=function(){return(new Date).getTime()};google.log=function(a,b,c,e,g){a=google.logUrl(a,b,c,e,g);if(""!=a){b=new Image;var d=google.lc,f=google.li;d[f]=b;b.onerror=b.onload=b.onabort=function(){delete d[f]};window.google&&window.google.vel&&window.google.vel.lu&&window.google.vel.lu(a);b.src=a;google.li=f+1}};google.logUrl=function(a,b,c,e,g){var d="",f=google.ls||"";if(!c&&-1==b.search("&ei=")){var h=google.getEI(e),d="&ei="+h;-1==b.search("&lei=")&&((e=google.getLEI(e))?d+="&lei="+e:h!=google.kEI&&(d+="&lei="+google.kEI))}a=c||"/"+(g||"gen_204")+"?atyp=i&ct="+a+"&cad="+b+d+f+"&zx="+google.time();/^http:/i.test(a)&&google.https()&&(google.ml(Error("a"),!1,{src:a,glmm:1}),a="");return a};google.y={};google.x=function(a,b){google.y[a.id]=[a,b];return!1};google.load=function(a,b,c){google.x({id:a+k++},function(){google.load(a,b,c)})};var k=0;})();var _gjwl=location;function _gjuc(){var a=_gjwl.href.indexOf("#");if(0<=a&&(a=_gjwl.href.substring(a),0<a.indexOf("&q=")||0<=a.indexOf("#q="))&&(a=a.substring(1),-1==a.indexOf("#"))){for(var d=0;d<a.length;){var b=d;"&"==a.charAt(b)&&++b;var c=a.indexOf("&",b);-1==c&&(c=a.length);b=a.substring(b,c);if(0==b.indexOf("fp="))a=a.substring(0,d)+a.substring(c,a.length),c=d;else if("cad=h"==b)return 0;d=c}_gjwl.href="/search?"+a+"&cad=h";return 1}return 0}
 5
+function _gjh(){!_gjuc()&&window.google&&google.x&&google.x({id:"GJH"},function(){google.nav&&google.nav.gjh&&google.nav.gjh()})};window._gjh&&_gjh();</script><style>#gbar,#guser{font-size:13px;padding-top:1px !important;}#gbar{height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}@media all{.gb1{height:22px;margin-right:.5em;vertical-align:top}#gbar{float:left}}a.gb1,a.gb4{text-decoration:underline !important}a.gb1,a.gb4{color:#00c !important}.gbi .gb4{color:#dd8e27 !important}.gbf .gb4{color:#900 !important}
 6
+</style><style>body,td,a,p,.h{font-family:arial,sans-serif}body{margin:0;overflow-y:scroll}#gog{padding:3px 8px 0}td{line-height:.8em}.gac_m td{line-height:17px}form{margin-bottom:20px}.h{color:#36c}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}em{font-weight:bold;font-style:normal}.lst{height:25px;width:496px}.gsfi,.lst{font:18px arial,sans-serif}.gsfs{font:17px arial,sans-serif}.ds{display:inline-box;display:inline-block;margin:3px 0 4px;margin-left:4px}input{font-family:inherit}a.gb1,a.gb2,a.gb3,a.gb4{color:#11c !important}body{background:#fff;color:black}a{color:#11c;text-decoration:none}a:hover,a:active{text-decoration:underline}.fl a{color:#36c}a:visited{color:#551a8b}a.gb1,a.gb4{text-decoration:underline}a.gb3:hover{text-decoration:none}#ghead a.gb2:hover{color:#fff !important}.sblc{padding-top:5px}.sblc a{display:block;margin:2px 0;margin-left:13px;font-size:11px}.lsbb{background:#eee;border:solid 1px;border-color:#ccc #999 #999 #ccc;height:30px}.lsbb{display:block}.ftl,#fll a{display:inline-block;margin:0 12px}.lsb{background:url(/images/nav_logo229.png) 0 -261px repeat-x;border:none;color:#000;cursor:pointer;height:30px;margin:0;outline:0;font:15px arial,sans-serif;vertical-align:top}.lsb:active{background:#ccc}.lst:focus{outline:none}</style><script></script><link href="/images/branding/product/ico/googleg_lodp.ico" rel="shortcut icon"></head><body bgcolor="#fff"><script>(function(){var src='/images/nav_logo229.png';var iesg=false;document.body.onload = function(){window.n && window.n();if (document.images){new Image().src=src;}
 7
+if (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbqf.q.focus();}
 8
+}
 9
+})();</script><div id="mngb">    <div id=gbar><nobr><b class=gb1>Search</b> <a class=gb1 href="http://www.google.co.in/imghp?hl=en&tab=wi">Images</a> <a class=gb1 href="http://maps.google.co.in/maps?hl=en&tab=wl">Maps</a> <a class=gb1 href="https://play.google.com/?hl=en&tab=w8">Play</a> <a class=gb1 href="http://www.youtube.com/?gl=IN&tab=w1">YouTube</a> <a class=gb1 href="http://news.google.co.in/nwshp?hl=en&tab=wn">News</a> <a class=gb1 href="https://mail.google.com/mail/?tab=wm">Gmail</a> <a class=gb1 href="https://drive.google.com/?tab=wo">Drive</a> <a class=gb1 style="text-decoration:none" href="https://www.google.co.in/intl/en/options/"><u>More</u> &raquo;</a></nobr></div><div id=guser width=100%><nobr><span id=gbn class=gbi></span><span id=gbf class=gbf></span><span id=gbe></span><a href="http://www.google.co.in/history/optout?hl=en" class=gb4>Web History</a> | <a  href="/preferences?hl=en" class=gb4>Settings</a> | <a target=_top id=gb_70 href="https://accounts.google.com/ServiceLogin?hl=en&passive=true&continue=http://www.google.co.in/%3Fgfe_rd%3Dcr%26ei%3De1q9V86CDuKK8QeCkoiACA" class=gb4>Sign in</a></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div>    </div><center><br clear="all" id="lgpd"><div id="lga"><div style="padding:28px 0 3px"><div style="height:110px;width:276px;background:url(/images/branding/googlelogo/1x/googlelogo_white_background_color_272x92dp.png) no-repeat" title="Google" align="left" id="hplogo" onload="window.lol&&lol()"><div style="color:#777;font-size:16px;font-weight:bold;position:relative;top:70px;left:218px" nowrap="">India</div></div></div><br></div><form action="/search" name="f"><table cellpadding="0" cellspacing="0"><tr valign="top"><td width="25%">&nbsp;</td><td align="center" nowrap=""><input name="ie" value="ISO-8859-1" type="hidden"><input value="en-IN" name="hl" type="hidden"><input name="source" type="hidden" value="hp"><input name="biw" type="hidden"><input name="bih" type="hidden"><div class="ds" style="height:32px;margin:4px 0"><input style="color:#000;margin:0;padding:5px 8px 0 6px;vertical-align:top" autocomplete="off" class="lst" value="" title="Google Search" maxlength="2048" name="q" size="57"></div><br style="line-height:0"><span class="ds"><span class="lsbb"><input class="lsb" value="Google Search" name="btnG" type="submit"></span></span><span class="ds"><span class="lsbb"><input class="lsb" value="I'm Feeling Lucky" name="btnI" onclick="if(this.form.q.value)this.checked=1; else top.location='/doodles/'" type="submit"></span></span></td><td class="fl sblc" align="left" nowrap="" width="25%"><a href="/advanced_search?hl=en-IN&amp;authuser=0">Advanced search</a><a href="/language_tools?hl=en-IN&amp;authuser=0">Language tools</a></td></tr></table><input id="gbv" name="gbv" type="hidden" value="1"></form><div id="gac_scont"></div><div style="font-size:83%;min-height:3.5em"><br><div id="prm"><style>.szppmdbYutt__middle-slot-promo{font-size:small;margin-bottom:32px}.szppmdbYutt__middle-slot-promo a._uFi{display:inline-block;text-decoration:none}.szppmdbYutt__middle-slot-promo img{border:none;margin-right:5px;vertical-align:middle}.szppmdbYutt__middle-slot-promo ._vFi{color:red}</style><div class="szppmdbYutt__middle-slot-promo r-i_ZIfBTTakK8" jsl="$t t-Gza07Ho9En4;$x 0;" data-ved="0ahUKEwjXsY3v0NnOAhVIsY8KHSMdCF8QnIcBCAQ"><span class="_vFi"></span>Google Translate with improved offline mode. Get it now on <a class="_XIi" href="https://www.google.com/url?q=https://play.google.com/store/apps/details%3Fid%3Dcom.google.android.apps.translate%26hl%3Den%26referrer%3Dutm_source%253Dgoogle%2526utm_campaign%253Doffline%2526utm_name%253Den&amp;source=hpp&amp;id=5085213&amp;ct=8&amp;usg=AFQjCNE_M--N8XI67IQ-_8ZdpQbuVD6giw&amp;sa=X&amp;ved=0ahUKEwjXsY3v0NnOAhVIsY8KHSMdCF8Q8IcBCAU" rel="nofollow">Android</a> or <span class="_vFi"></span><a class="_XIi" href="https://www.google.com/url?q=https://itunes.apple.com/app/google-translate/id414706506%3Fpt%3D9008%26ct%3Den-mobile-offline-hpp%26mt%3D8&amp;source=hpp&amp;id=5085213&amp;ct=8&amp;usg=AFQjCNFWpMjUEQNEjRSgr__KaMD6GUxGIA&amp;sa=X&amp;ved=0ahUKEwjXsY3v0NnOAhVIsY8KHSMdCF8Q8IcBCAY" rel="nofollow">iOS</a></div></div><div id="als"><style>#als{font-size:small;margin-bottom:24px}#_eEe{display:inline-block;line-height:28px;}#_eEe a{padding:0 3px;}._lEe{display:inline-block;margin:0 2px;white-space:nowrap}._PEe{display:inline-block;margin:0 2px}</style><div id="_eEe">Google.co.in offered in: <a href="http://www.google.co.in/setprefs?sig=0_sQ1sGBMXUdloWP-6otJqhSXgXVA%3D&amp;hl=hi&amp;source=homepage" data-ved="0ahUKEwjXsY3v0NnOAhVIsY8KHSMdCF8Q2ZgBCAg">&#2361;&#2367;&#2344;&#2381;&#2342;&#2368;</a>  <a href="http://www.google.co.in/setprefs?sig=0_sQ1sGBMXUdloWP-6otJqhSXgXVA%3D&amp;hl=bn&amp;source=homepage" data-ved="0ahUKEwjXsY3v0NnOAhVIsY8KHSMdCF8Q2ZgBCAk">&#2476;&#2494;&#2434;&#2482;&#2494;</a>  <a href="http://www.google.co.in/setprefs?sig=0_sQ1sGBMXUdloWP-6otJqhSXgXVA%3D&amp;hl=te&amp;source=homepage" data-ved="0ahUKEwjXsY3v0NnOAhVIsY8KHSMdCF8Q2ZgBCAo">&#3108;&#3142;&#3122;&#3137;&#3095;&#3137;</a>  <a href="http://www.google.co.in/setprefs?sig=0_sQ1sGBMXUdloWP-6otJqhSXgXVA%3D&amp;hl=mr&amp;source=homepage" data-ved="0ahUKEwjXsY3v0NnOAhVIsY8KHSMdCF8Q2ZgBCAs">&#2350;&#2352;&#2366;&#2336;&#2368;</a>  <a href="http://www.google.co.in/setprefs?sig=0_sQ1sGBMXUdloWP-6otJqhSXgXVA%3D&amp;hl=ta&amp;source=homepage" data-ved="0ahUKEwjXsY3v0NnOAhVIsY8KHSMdCF8Q2ZgBCAw">&#2980;&#2990;&#3007;&#2996;&#3021;</a>  <a href="http://www.google.co.in/setprefs?sig=0_sQ1sGBMXUdloWP-6otJqhSXgXVA%3D&amp;hl=gu&amp;source=homepage" data-ved="0ahUKEwjXsY3v0NnOAhVIsY8KHSMdCF8Q2ZgBCA0">&#2711;&#2753;&#2716;&#2736;&#2750;&#2724;&#2752;</a>  <a href="http://www.google.co.in/setprefs?sig=0_sQ1sGBMXUdloWP-6otJqhSXgXVA%3D&amp;hl=kn&amp;source=homepage" data-ved="0ahUKEwjXsY3v0NnOAhVIsY8KHSMdCF8Q2ZgBCA4">&#3221;&#3240;&#3277;&#3240;&#3233;</a>  <a href="http://www.google.co.in/setprefs?sig=0_sQ1sGBMXUdloWP-6otJqhSXgXVA%3D&amp;hl=ml&amp;source=homepage" data-ved="0ahUKEwjXsY3v0NnOAhVIsY8KHSMdCF8Q2ZgBCA8">&#3374;&#3378;&#3375;&#3390;&#3379;&#3330;</a>  <a href="http://www.google.co.in/setprefs?sig=0_sQ1sGBMXUdloWP-6otJqhSXgXVA%3D&amp;hl=pa&amp;source=homepage" data-ved="0ahUKEwjXsY3v0NnOAhVIsY8KHSMdCF8Q2ZgBCBA">&#2602;&#2672;&#2588;&#2622;&#2604;&#2624;</a> </div></div></div><span id="footer"><div style="font-size:10pt"><div style="margin:19px auto;text-align:center" id="fll"><a href="/intl/en/ads/">Advertising Programs</a><a href="http://www.google.co.in/services/">Business Solutions</a><a href="https://plus.google.com/104205742743787718296" rel="publisher">+Google</a><a href="/intl/en/about.html">About Google</a><a href="http://www.google.co.in/setprefdomain?prefdom=US&amp;sig=__A53jsG-eGKvuTPXQTrCuG_Y4Nog%3D" id="fehl">Google.com</a></div></div><p style="color:#767676;font-size:8pt">&copy; 2016 - <a href="/intl/en/policies/privacy/">Privacy</a> - <a href="/intl/en/policies/terms/">Terms</a></p></span></center><script>(function(){window.google.cdo={height:0,width:0};(function(){var a=window.innerWidth,b=window.innerHeight;if(!a||!b)var c=window.document,d="CSS1Compat"==c.compatMode?c.documentElement:c.body,a=d.clientWidth,b=d.clientHeight;a&&b&&(a!=google.cdo.width||b!=google.cdo.height)&&google.log("","","/client_204?&atyp=i&biw="+a+"&bih="+b+"&ei="+google.kEI);})();})();</script><div id="xjsd"></div><div id="xjsi"><script>(function(){function c(b){window.setTimeout(function(){var a=document.createElement("script");a.src=b;document.getElementById("xjsd").appendChild(a)},0)}google.dljp=function(b,a){google.xjsu=b;c(a)};google.dlj=c;})();(function(){window.google.xjsrm=['mids'];})();if(google.y)google.y.first=[];if(!google.xjs){window._=window._||{};window._._DumpException=function(e){throw e};if(google.timers&&google.timers.load.t){google.timers.load.t.xjsls=new Date().getTime();}google.dljp('/xjs/_/js/k\x3dxjs.hp.en_US.eTq7Yqbxgvk.O/m\x3dsb_he,d/rt\x3dj/d\x3d1/t\x3dzcms/rs\x3dACT90oF-3qtoiuclcJNqDkudJ6b-I_QYWA','/xjs/_/js/k\x3dxjs.hp.en_US.eTq7Yqbxgvk.O/m\x3dsb_he,d/rt\x3dj/d\x3d1/t\x3dzcms/rs\x3dACT90oF-3qtoiuclcJNqDkudJ6b-I_QYWA');google.xjs=1;}google.pmc={"sb_he":{"agen":true,"cgen":true,"client":"heirloom-hp","dh":true,"dhqt":true,"ds":"","fl":true,"host":"google.co.in","isbh":28,"jam":0,"jsonp":true,"msgs":{"cibl":"Clear Search","dym":"Did you mean:","lcky":"I\u0026#39;m Feeling Lucky","lml":"Learn more","oskt":"Input tools","psrc":"This search was removed from your \u003Ca href=\"/history\"\u003EWeb History\u003C/a\u003E","psrl":"Remove","sbit":"Search by image","srch":"Google Search"},"nds":true,"ovr":{},"pq":"","refpd":true,"rfs":[],"scd":10,"sce":5,"stok":"_F4Kr1JRZ6vb5B5CwgPm9baCSEI"},"d":{}};google.y.first.push(function(){if(google.med){google.med('init');google.initHistory();google.med('history');}});if(google.j&&google.j.en&&google.j.xi){window.setTimeout(google.j.xi,0);}
10
+</script></div></body></html>
Back to file index

layer.yaml

 1
--- 
 2
+++ layer.yaml
 3
@@ -0,0 +1,25 @@
 4
+"includes":
 5
+- "layer:ibm-im"
 6
+- "layer:ibm-base"
 7
+- "layer:apt"
 8
+- "layer:leadership"
 9
+- "layer:basic"
10
+- "layer:ibm-was-nd"
11
+- "interface:dm-node"
12
+"options":
13
+  "basic":
14
+    "packages":
15
+    - "pwgen"
16
+    - "unzip"
17
+    - "curl"
18
+    "use_venv": !!bool "false"
19
+    "include_system_packages": !!bool "false"
20
+  "ibm-im": {}
21
+  "apt":
22
+    "packages": []
23
+  "leadership": {}
24
+  "ibm-base": {}
25
+  "ibm-was-nd-node": {}
26
+  "ibm-was-nd": {}
27
+"repo": "bzr+ssh://bazaar.launchpad.net/~ibmcharmers/charms/trusty/layer-ibm-im/trunk/"
28
+"is": "ibm-was-nd-node"
Back to file index

lib/charms/__init__.py

1
--- 
2
+++ lib/charms/__init__.py
3
@@ -0,0 +1,2 @@
4
+from pkgutil import extend_path
5
+__path__ = extend_path(__path__, __name__)
Back to file index

lib/charms/apt.py

  1
--- 
  2
+++ lib/charms/apt.py
  3
@@ -0,0 +1,182 @@
  4
+# Copyright 2015-2016 Canonical Ltd.
  5
+#
  6
+# This file is part of the Apt layer for Juju.
  7
+#
  8
+# This program is free software: you can redistribute it and/or modify
  9
+# it under the terms of the GNU General Public License version 3, as
 10
+# published by the Free Software Foundation.
 11
+#
 12
+# This program is distributed in the hope that it will be useful, but
 13
+# WITHOUT ANY WARRANTY; without even the implied warranties of
 14
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 15
+# PURPOSE.  See the GNU General Public License for more details.
 16
+#
 17
+# You should have received a copy of the GNU General Public License
 18
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 19
+
 20
+'''
 21
+charms.reactive helpers for dealing with deb packages.
 22
+
 23
+Add apt package sources using add_source(). Queue deb packages for
 24
+installation with install(). Configure and work with your software
 25
+once the apt.installed.{packagename} state is set.
 26
+'''
 27
+import itertools
 28
+import subprocess
 29
+
 30
+from charmhelpers import fetch
 31
+from charmhelpers.core import hookenv, unitdata
 32
+from charms import reactive
 33
+
 34
+
 35
+__all__ = ['add_source', 'update', 'queue_install', 'install_queued',
 36
+           'installed', 'purge', 'ensure_package_status']
 37
+
 38
+
 39
+def add_source(source, key=None):
 40
+    '''Add an apt source.
 41
+
 42
+    Sets the apt.needs_update state.
 43
+
 44
+    A source may be either a line that can be added directly to
 45
+    sources.list(5), or in the form ppa:<user>/<ppa-name> for adding
 46
+    Personal Package Archives, or a distribution component to enable.
 47
+
 48
+    The package signing key should be an ASCII armoured GPG key. While
 49
+    GPG key ids are also supported, the retrieval mechanism is insecure.
 50
+    There is no need to specify the package signing key for PPAs or for
 51
+    the main Ubuntu archives.
 52
+    '''
 53
+    # Maybe we should remember which sources have been added already
 54
+    # so we don't waste time re-adding them. Is this time significant?
 55
+    fetch.add_source(source, key)
 56
+    reactive.set_state('apt.needs_update')
 57
+
 58
+
 59
+def queue_install(packages, options=None):
 60
+    """Queue one or more deb packages for install.
 61
+
 62
+    The `apt.installed.{name}` state is set once the package is installed.
 63
+
 64
+    If a package has already been installed it will not be reinstalled.
 65
+
 66
+    If a package has already been queued it will not be requeued, and
 67
+    the install options will not be changed.
 68
+
 69
+    Sets the apt.queued_installs state.
 70
+    """
 71
+    if isinstance(packages, str):
 72
+        packages = [packages]
 73
+    # Filter installed packages.
 74
+    store = unitdata.kv()
 75
+    queued_packages = store.getrange('apt.install_queue.', strip=True)
 76
+    packages = {package: options for package in packages
 77
+                if not (package in queued_packages or
 78
+                        reactive.helpers.is_state('apt.installed.' + package))}
 79
+    if packages:
 80
+        unitdata.kv().update(packages, prefix='apt.install_queue.')
 81
+        reactive.set_state('apt.queued_installs')
 82
+
 83
+
 84
+def installed():
 85
+    '''Return the set of deb packages completed install'''
 86
+    return set(state.split('.', 2)[2] for state in reactive.bus.get_states()
 87
+               if state.startswith('apt.installed.'))
 88
+
 89
+
 90
+def purge(packages):
 91
+    """Purge one or more deb packages from the system"""
 92
+    fetch.apt_purge(packages, fatal=True)
 93
+    store = unitdata.kv()
 94
+    store.unsetrange(packages, prefix='apt.install_queue.')
 95
+    for package in packages:
 96
+        reactive.remove_state('apt.installed.{}'.format(package))
 97
+
 98
+
 99
+def update():
100
+    """Update the apt cache.
101
+
102
+    Removes the apt.needs_update state.
103
+    """
104
+    status_set(None, 'Updating apt cache')
105
+    fetch.apt_update(fatal=True)  # Friends don't let friends set fatal=False
106
+    reactive.remove_state('apt.needs_update')
107
+
108
+
109
+def install_queued():
110
+    '''Installs queued deb packages.
111
+
112
+    Removes the apt.queued_installs state and sets the apt.installed state.
113
+
114
+    On failure, sets the unit's workload state to 'blocked' and returns
115
+    False. Package installs remain queued.
116
+
117
+    On success, sets the apt.installed.{packagename} state for each
118
+    installed package and returns True.
119
+    '''
120
+    store = unitdata.kv()
121
+    queue = sorted((options, package)
122
+                   for package, options in store.getrange('apt.install_queue.',
123
+                                                          strip=True).items())
124
+
125
+    installed = set()
126
+    for options, batch in itertools.groupby(queue, lambda x: x[0]):
127
+        packages = [b[1] for b in batch]
128
+        try:
129
+            status_set(None, 'Installing {}'.format(','.join(packages)))
130
+            fetch.apt_install(packages, options, fatal=True)
131
+            store.unsetrange(packages, prefix='apt.install_queue.')
132
+            installed.update(packages)
133
+        except subprocess.CalledProcessError:
134
+            status_set('blocked',
135
+                       'Unable to install packages {}'
136
+                       .format(','.join(packages)))
137
+            return False  # Without setting reactive state.
138
+
139
+    for package in installed:
140
+        reactive.set_state('apt.installed.{}'.format(package))
141
+
142
+    reactive.remove_state('apt.queued_installs')
143
+    return True
144
+
145
+
146
+def ensure_package_status():
147
+    '''Hold or unhold packages per the package_status configuration option.
148
+
149
+    All packages installed using this module and handlers are affected.
150
+
151
+    An mechanism may be added in the future to override this for a
152
+    subset of installed packages.
153
+    '''
154
+    packages = installed()
155
+    if not packages:
156
+        return
157
+    config = hookenv.config()
158
+    package_status = config['package_status']
159
+    changed = reactive.helpers.data_changed('apt.package_status',
160
+                                            (package_status, sorted(packages)))
161
+    if changed:
162
+        if package_status == 'hold':
163
+            hookenv.log('Holding packages {}'.format(','.join(packages)))
164
+            fetch.apt_hold(packages)
165
+        else:
166
+            hookenv.log('Unholding packages {}'.format(','.join(packages)))
167
+            fetch.apt_unhold(packages)
168
+    reactive.remove_state('apt.needs_hold')
169
+
170
+
171
+def status_set(state, message):
172
+    """Set the unit's workload status.
173
+
174
+    Set state == None to keep the same state and just change the message.
175
+    """
176
+    if state is None:
177
+        state = hookenv.status_get()[0]
178
+        if state == 'unknown':
179
+            state = 'maintenance'  # Guess
180
+    if state in ('error', 'blocked'):
181
+        lvl = hookenv.WARNING
182
+    else:
183
+        lvl = hookenv.INFO
184
+    hookenv.status_set(state, message)
185
+    hookenv.log('{}: {}'.format(state, message), lvl)
Back to file index

lib/charms/layer/__init__.py

 1
--- 
 2
+++ lib/charms/layer/__init__.py
 3
@@ -0,0 +1,21 @@
 4
+import os
 5
+
 6
+
 7
+class LayerOptions(dict):
 8
+    def __init__(self, layer_file, section=None):
 9
+        import yaml  # defer, might not be available until bootstrap
10
+        with open(layer_file) as f:
11
+            layer = yaml.safe_load(f.read())
12
+        opts = layer.get('options', {})
13
+        if section and section in opts:
14
+            super(LayerOptions, self).__init__(opts.get(section))
15
+        else:
16
+            super(LayerOptions, self).__init__(opts)
17
+
18
+
19
+def options(section=None, layer_file=None):
20
+    if not layer_file:
21
+        base_dir = os.environ.get('CHARM_DIR', os.getcwd())
22
+        layer_file = os.path.join(base_dir, 'layer.yaml')
23
+
24
+    return LayerOptions(layer_file, section)
Back to file index

lib/charms/layer/basic.py

  1
--- 
  2
+++ lib/charms/layer/basic.py
  3
@@ -0,0 +1,159 @@
  4
+import os
  5
+import sys
  6
+import shutil
  7
+import platform
  8
+from glob import glob
  9
+from subprocess import check_call
 10
+
 11
+from charms.layer.execd import execd_preinstall
 12
+
 13
+
 14
+def bootstrap_charm_deps():
 15
+    """
 16
+    Set up the base charm dependencies so that the reactive system can run.
 17
+    """
 18
+    # execd must happen first, before any attempt to install packages or
 19
+    # access the network, because sites use this hook to do bespoke
 20
+    # configuration and install secrets so the rest of this bootstrap
 21
+    # and the charm itself can actually succeed. This call does nothing
 22
+    # unless the operator has created and populated $CHARM_DIR/exec.d.
 23
+    execd_preinstall()
 24
+    # ensure that $CHARM_DIR/bin is on the path, for helper scripts
 25
+    os.environ['PATH'] += ':%s' % os.path.join(os.environ['CHARM_DIR'], 'bin')
 26
+    venv = os.path.abspath('../.venv')
 27
+    vbin = os.path.join(venv, 'bin')
 28
+    vpip = os.path.join(vbin, 'pip')
 29
+    vpy = os.path.join(vbin, 'python')
 30
+    if os.path.exists('wheelhouse/.bootstrapped'):
 31
+        from charms import layer
 32
+        cfg = layer.options('basic')
 33
+        if cfg.get('use_venv') and '.venv' not in sys.executable:
 34
+            # activate the venv
 35
+            os.environ['PATH'] = ':'.join([vbin, os.environ['PATH']])
 36
+            reload_interpreter(vpy)
 37
+        return
 38
+    # bootstrap wheelhouse
 39
+    if os.path.exists('wheelhouse'):
 40
+        with open('/root/.pydistutils.cfg', 'w') as fp:
 41
+            # make sure that easy_install also only uses the wheelhouse
 42
+            # (see https://github.com/pypa/pip/issues/410)
 43
+            charm_dir = os.environ['CHARM_DIR']
 44
+            fp.writelines([
 45
+                "[easy_install]\n",
 46
+                "allow_hosts = ''\n",
 47
+                "find_links = file://{}/wheelhouse/\n".format(charm_dir),
 48
+            ])
 49
+        apt_install(['python3-pip', 'python3-setuptools', 'python3-yaml'])
 50
+        from charms import layer
 51
+        cfg = layer.options('basic')
 52
+        # include packages defined in layer.yaml
 53
+        apt_install(cfg.get('packages', []))
 54
+        # if we're using a venv, set it up
 55
+        if cfg.get('use_venv'):
 56
+            if not os.path.exists(venv):
 57
+                distname, version, series = platform.linux_distribution()
 58
+                if series in ('precise', 'trusty'):
 59
+                    apt_install(['python-virtualenv'])
 60
+                else:
 61
+                    apt_install(['virtualenv'])
 62
+                cmd = ['virtualenv', '-ppython3', '--never-download', venv]
 63
+                if cfg.get('include_system_packages'):
 64
+                    cmd.append('--system-site-packages')
 65
+                check_call(cmd)
 66
+            os.environ['PATH'] = ':'.join([vbin, os.environ['PATH']])
 67
+            pip = vpip
 68
+        else:
 69
+            pip = 'pip3'
 70
+            # save a copy of system pip to prevent `pip3 install -U pip`
 71
+            # from changing it
 72
+            if os.path.exists('/usr/bin/pip'):
 73
+                shutil.copy2('/usr/bin/pip', '/usr/bin/pip.save')
 74
+        # need newer pip, to fix spurious Double Requirement error:
 75
+        # https://github.com/pypa/pip/issues/56
 76
+        check_call([pip, 'install', '-U', '--no-index', '-f', 'wheelhouse',
 77
+                    'pip'])
 78
+        # install the rest of the wheelhouse deps
 79
+        check_call([pip, 'install', '-U', '--no-index', '-f', 'wheelhouse'] +
 80
+                   glob('wheelhouse/*'))
 81
+        if not cfg.get('use_venv'):
 82
+            # restore system pip to prevent `pip3 install -U pip`
 83
+            # from changing it
 84
+            if os.path.exists('/usr/bin/pip.save'):
 85
+                shutil.copy2('/usr/bin/pip.save', '/usr/bin/pip')
 86
+                os.remove('/usr/bin/pip.save')
 87
+        os.remove('/root/.pydistutils.cfg')
 88
+        # flag us as having already bootstrapped so we don't do it again
 89
+        open('wheelhouse/.bootstrapped', 'w').close()
 90
+        # Ensure that the newly bootstrapped libs are available.
 91
+        # Note: this only seems to be an issue with namespace packages.
 92
+        # Non-namespace-package libs (e.g., charmhelpers) are available
 93
+        # without having to reload the interpreter. :/
 94
+        reload_interpreter(vpy if cfg.get('use_venv') else sys.argv[0])
 95
+
 96
+
 97
+def reload_interpreter(python):
 98
+    """
 99
+    Reload the python interpreter to ensure that all deps are available.
100
+
101
+    Newly installed modules in namespace packages sometimes seemt to
102
+    not be picked up by Python 3.
103
+    """
104
+    os.execle(python, python, sys.argv[0], os.environ)
105
+
106
+
107
+def apt_install(packages):
108
+    """
109
+    Install apt packages.
110
+
111
+    This ensures a consistent set of options that are often missed but
112
+    should really be set.
113
+    """
114
+    if isinstance(packages, (str, bytes)):
115
+        packages = [packages]
116
+
117
+    env = os.environ.copy()
118
+
119
+    if 'DEBIAN_FRONTEND' not in env:
120
+        env['DEBIAN_FRONTEND'] = 'noninteractive'
121
+
122
+    cmd = ['apt-get',
123
+           '--option=Dpkg::Options::=--force-confold',
124
+           '--assume-yes',
125
+           'install']
126
+    check_call(cmd + packages, env=env)
127
+
128
+
129
+def init_config_states():
130
+    import yaml
131
+    from charmhelpers.core import hookenv
132
+    from charms.reactive import set_state
133
+    from charms.reactive import toggle_state
134
+    config = hookenv.config()
135
+    config_defaults = {}
136
+    config_defs = {}
137
+    config_yaml = os.path.join(hookenv.charm_dir(), 'config.yaml')
138
+    if os.path.exists(config_yaml):
139
+        with open(config_yaml) as fp:
140
+            config_defs = yaml.safe_load(fp).get('options', {})
141
+            config_defaults = {key: value.get('default')
142
+                               for key, value in config_defs.items()}
143
+    for opt in config_defs.keys():
144
+        if config.changed(opt):
145
+            set_state('config.changed')
146
+            set_state('config.changed.{}'.format(opt))
147
+        toggle_state('config.set.{}'.format(opt), config.get(opt))
148
+        toggle_state('config.default.{}'.format(opt),
149
+                     config.get(opt) == config_defaults[opt])
150
+    hookenv.atexit(clear_config_states)
151
+
152
+
153
+def clear_config_states():
154
+    from charmhelpers.core import hookenv, unitdata
155
+    from charms.reactive import remove_state
156
+    config = hookenv.config()
157
+    remove_state('config.changed')
158
+    for opt in config.keys():
159
+        remove_state('config.changed.{}'.format(opt))
160
+        remove_state('config.set.{}'.format(opt))
161
+        remove_state('config.default.{}'.format(opt))
162
+    unitdata.kv().flush()
Back to file index

lib/charms/layer/execd.py

  1
--- 
  2
+++ lib/charms/layer/execd.py
  3
@@ -0,0 +1,138 @@
  4
+# Copyright 2014-2016 Canonical Limited.
  5
+#
  6
+# This file is part of layer-basic, the reactive base layer for Juju.
  7
+#
  8
+# charm-helpers is free software: you can redistribute it and/or modify
  9
+# it under the terms of the GNU Lesser General Public License version 3 as
 10
+# published by the Free Software Foundation.
 11
+#
 12
+# charm-helpers is distributed in the hope that it will be useful,
 13
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
 14
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15
+# GNU Lesser General Public License for more details.
 16
+#
 17
+# You should have received a copy of the GNU Lesser General Public License
 18
+# along with charm-helpers.  If not, see <http://www.gnu.org/licenses/>.
 19
+
 20
+# This module may only import from the Python standard library.
 21
+import os
 22
+import sys
 23
+import subprocess
 24
+import time
 25
+
 26
+'''
 27
+execd/preinstall
 28
+
 29
+It is often necessary to configure and reconfigure machines
 30
+after provisioning, but before attempting to run the charm.
 31
+Common examples are specialized network configuration, enabling
 32
+of custom hardware, non-standard disk partitioning and filesystems,
 33
+adding secrets and keys required for using a secured network.
 34
+
 35
+The reactive framework's base layer invokes this mechanism as
 36
+early as possible, before any network access is made or dependencies
 37
+unpacked or non-standard modules imported (including the charms.reactive
 38
+framework itself).
 39
+
 40
+Operators needing to use this functionality may branch a charm and
 41
+create an exec.d directory in it. The exec.d directory in turn contains
 42
+one or more subdirectories, each of which contains an executable called
 43
+charm-pre-install and any other required resources. The charm-pre-install
 44
+executables are run, and if successful, state saved so they will not be
 45
+run again.
 46
+
 47
+    $CHARM_DIR/exec.d/mynamespace/charm-pre-install
 48
+
 49
+An alternative to branching a charm is to compose a new charm that contains
 50
+the exec.d directory, using the original charm as a layer,
 51
+
 52
+A charm author could also abuse this mechanism to modify the charm
 53
+environment in unusual ways, but for most purposes it is saner to use
 54
+charmhelpers.core.hookenv.atstart().
 55
+'''
 56
+
 57
+
 58
+def default_execd_dir():
 59
+    return os.path.join(os.environ['CHARM_DIR'], 'exec.d')
 60
+
 61
+
 62
+def execd_module_paths(execd_dir=None):
 63
+    """Generate a list of full paths to modules within execd_dir."""
 64
+    if not execd_dir:
 65
+        execd_dir = default_execd_dir()
 66
+
 67
+    if not os.path.exists(execd_dir):
 68
+        return
 69
+
 70
+    for subpath in os.listdir(execd_dir):
 71
+        module = os.path.join(execd_dir, subpath)
 72
+        if os.path.isdir(module):
 73
+            yield module
 74
+
 75
+
 76
+def execd_submodule_paths(command, execd_dir=None):
 77
+    """Generate a list of full paths to the specified command within exec_dir.
 78
+    """
 79
+    for module_path in execd_module_paths(execd_dir):
 80
+        path = os.path.join(module_path, command)
 81
+        if os.access(path, os.X_OK) and os.path.isfile(path):
 82
+            yield path
 83
+
 84
+
 85
+def execd_sentinel_path(submodule_path):
 86
+    module_path = os.path.dirname(submodule_path)
 87
+    execd_path = os.path.dirname(module_path)
 88
+    module_name = os.path.basename(module_path)
 89
+    submodule_name = os.path.basename(submodule_path)
 90
+    return os.path.join(execd_path,
 91
+                        '.{}_{}.done'.format(module_name, submodule_name))
 92
+
 93
+
 94
+def execd_run(command, execd_dir=None, stop_on_error=True, stderr=None):
 95
+    """Run command for each module within execd_dir which defines it."""
 96
+    if stderr is None:
 97
+        stderr = sys.stdout
 98
+    for submodule_path in execd_submodule_paths(command, execd_dir):
 99
+        # Only run each execd once. We cannot simply run them in the
100
+        # install hook, as potentially storage hooks are run before that.
101
+        # We cannot rely on them being idempotent.
102
+        sentinel = execd_sentinel_path(submodule_path)
103
+        if os.path.exists(sentinel):
104
+            continue
105
+
106
+        try:
107
+            subprocess.check_call([submodule_path], stderr=stderr,
108
+                                  universal_newlines=True)
109
+            with open(sentinel, 'w') as f:
110
+                f.write('{} ran successfully {}\n'.format(submodule_path,
111
+                                                          time.ctime()))
112
+                f.write('Removing this file will cause it to be run again\n')
113
+        except subprocess.CalledProcessError as e:
114
+            # Logs get the details. We can't use juju-log, as the
115
+            # output may be substantial and exceed command line
116
+            # length limits.
117
+            print("ERROR ({}) running {}".format(e.returncode, e.cmd),
118
+                  file=stderr)
119
+            print("STDOUT<<EOM", file=stderr)
120
+            print(e.output, file=stderr)
121
+            print("EOM", file=stderr)
122
+
123
+            # Unit workload status gets a shorter fail message.
124
+            short_path = os.path.relpath(submodule_path)
125
+            block_msg = "Error ({}) running {}".format(e.returncode,
126
+                                                       short_path)
127
+            try:
128
+                subprocess.check_call(['status-set', 'blocked', block_msg],
129
+                                      universal_newlines=True)
130
+                if stop_on_error:
131
+                    sys.exit(0)  # Leave unit in blocked state.
132
+            except Exception:
133
+                pass  # We care about the exec.d/* failure, not status-set.
134
+
135
+            if stop_on_error:
136
+                sys.exit(e.returncode or 1)  # Error state for pre-1.24 Juju
137
+
138
+
139
+def execd_preinstall(execd_dir=None):
140
+    """Run charm-pre-install for each module within execd_dir."""
141
+    execd_run('charm-pre-install', execd_dir=execd_dir)
Back to file index

lib/charms/leadership.py

 1
--- 
 2
+++ lib/charms/leadership.py
 3
@@ -0,0 +1,58 @@
 4
+# Copyright 2015-2016 Canonical Ltd.
 5
+#
 6
+# This file is part of the Leadership Layer for Juju.
 7
+#
 8
+# This program is free software: you can redistribute it and/or modify
 9
+# it under the terms of the GNU General Public License version 3, as
10
+# published by the Free Software Foundation.
11
+#
12
+# This program is distributed in the hope that it will be useful, but
13
+# WITHOUT ANY WARRANTY; without even the implied warranties of
14
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15
+# PURPOSE.  See the GNU General Public License for more details.
16
+#
17
+# You should have received a copy of the GNU General Public License
18
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+
20
+from charmhelpers.core import hookenv
21
+from charmhelpers.core import unitdata
22
+
23
+from charms import reactive
24
+from charms.reactive import not_unless
25
+
26
+
27
+__all__ = ['leader_get', 'leader_set']
28
+
29
+
30
+@not_unless('leadership.is_leader')
31
+def leader_set(settings=None, **kw):
32
+    '''Change leadership settings, per charmhelpers.core.hookenv.leader_set.
33
+
34
+    The leadership.set.{key} reactive state will be set while the
35
+    leadership hook environment setting remains set.
36
+
37
+    Changed leadership settings will set the leadership.changed.{key}
38
+    and leadership.changed states. These states will remain set until
39
+    the following hook.
40
+
41
+    These state changes take effect immediately on the leader, and
42
+    in future hooks run on non-leaders. In this way both leaders and
43
+    non-leaders can share handlers, waiting on these states.
44
+    '''
45
+    settings = settings or {}
46
+    settings.update(kw)
47
+    previous = unitdata.kv().getrange('leadership.settings.', strip=True)
48
+
49
+    for key, value in settings.items():
50
+        if value != previous.get(key):
51
+            reactive.set_state('leadership.changed.{}'.format(key))
52
+            reactive.set_state('leadership.changed')
53
+        reactive.helpers.toggle_state('leadership.set.{}'.format(key),
54
+                                      value is not None)
55
+    hookenv.leader_set(settings)
56
+    unitdata.kv().update(settings, prefix='leadership.settings.')
57
+
58
+
59
+def leader_get(attribute=None):
60
+    '''Return leadership settings, per charmhelpers.core.hookenv.leader_get.'''
61
+    return hookenv.leader_get(attribute)
Back to file index

metadata.yaml

 1
--- 
 2
+++ metadata.yaml
 3
@@ -0,0 +1,54 @@
 4
+"name": "ibm-was-nd-node"
 5
+"summary": "WebSphere Application Server Network Deployment Cluster Node"
 6
+"maintainer": "IBM Juju Support Team <jujusupp@us.ibm.com>"
 7
+"description": |
 8
+  IBM WebSphere Application Server Network Deployment provides an advanced, flexible runtime environment for large-scale application deployments. It offers near-continuous availability with advanced performance and management capabilities for mission-critical applications.
 9
+"tags":
10
+- "ibm"
11
+- "misc"
12
+- "ibm"
13
+- "im"
14
+- "ibm"
15
+- "apt"
16
+- "leadership"
17
+- "ibm"
18
+- "misc"
19
+"requires":
20
+  "cluster-node":
21
+    "interface": "dm-node"
22
+"resources":
23
+  "ibm_was_nd_installer1":
24
+    "type": "file"
25
+    "filename": "ibm_was_nd_installer1.zip"
26
+    "description": "WAS ND installer part1 archive"
27
+  "ibm_was_nd_installer2":
28
+    "type": "file"
29
+    "filename": "ibm_was_nd_installer2.zip"
30
+    "description": "WAS ND installer part2 archive"
31
+  "ibm_was_nd_installer3":
32
+    "type": "file"
33
+    "filename": "ibm_was_nd_installer3.zip"
34
+    "description": "WAS ND installer part3 archive"
35
+  "ibm_was_nd_fp1":
36
+    "type": "file"
37
+    "filename": "ibm_was_nd_fp1.zip"
38
+    "description": "WAS ND fix pack part1 archive"
39
+  "ibm_was_nd_fp2":
40
+    "type": "file"
41
+    "filename": "ibm_was_nd_fp2.zip"
42
+    "description": "WAS ND fix pack part2 archive"
43
+  "ibm_im_installer":
44
+    "type": "file"
45
+    "filename": "ibm_im_installer.zip"
46
+    "description": "Installation Manager installer archive"
47
+  "ibm_im_fixpack":
48
+    "type": "file"
49
+    "filename": "ibm_im_fixpack.zip"
50
+    "description": "Installation Manager fix pack archive"
51
+"series":
52
+- "trusty"
53
+- "xenial"
54
+"subordinate": !!bool "false"
55
+"terms":
56
+- "ibm-im/1"
57
+- "ibm-was-nd/1"
Back to file index

reactive/apt.py

  1
--- 
  2
+++ reactive/apt.py
  3
@@ -0,0 +1,131 @@
  4
+# Copyright 2015-2016 Canonical Ltd.
  5
+#
  6
+# This file is part of the Apt layer for Juju.
  7
+#
  8
+# This program is free software: you can redistribute it and/or modify
  9
+# it under the terms of the GNU General Public License version 3, as
 10
+# published by the Free Software Foundation.
 11
+#
 12
+# This program is distributed in the hope that it will be useful, but
 13
+# WITHOUT ANY WARRANTY; without even the implied warranties of
 14
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 15
+# PURPOSE.  See the GNU General Public License for more details.
 16
+#
 17
+# You should have received a copy of the GNU General Public License
 18
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 19
+
 20
+'''
 21
+charms.reactive helpers for dealing with deb packages.
 22
+
 23
+Add apt package sources using add_source(). Queue deb packages for
 24
+installation with install(). Configure and work with your software
 25
+once the apt.installed.{packagename} state is set.
 26
+'''
 27
+import subprocess
 28
+
 29
+from charmhelpers import fetch
 30
+from charmhelpers.core import hookenv
 31
+from charmhelpers.core.hookenv import WARNING
 32
+from charms import layer
 33
+from charms import reactive
 34
+from charms.reactive import when, when_not
 35
+
 36
+import charms.apt
 37
+
 38
+
 39
+@when('apt.needs_update')
 40
+def update():
 41
+    charms.apt.update()
 42
+
 43
+
 44
+@when('apt.queued_installs')
 45
+@when_not('apt.needs_update')
 46
+def install_queued():
 47
+    charms.apt.install_queued()
 48
+
 49
+
 50
+@when_not('apt.queued_installs')
 51
+def ensure_package_status():
 52
+    charms.apt.ensure_package_status()
 53
+
 54
+
 55
+def filter_installed_packages(packages):
 56
+    # Don't use fetch.filter_installed_packages, as it depends on python-apt
 57
+    # and not available if the basic layer's use_site_packages option is off
 58
+    # TODO: Move this to charm-helpers.fetch
 59
+    cmd = ['dpkg-query', '--show', r'--showformat=${Package}\n']
 60
+    installed = set(subprocess.check_output(cmd,
 61
+                                            universal_newlines=True).split())
 62
+    return set(packages) - installed
 63
+
 64
+
 65
+def clear_removed_package_states():
 66
+    """On hook startup, clear install states for removed packages."""
 67
+    removed = filter_installed_packages(charms.apt.installed())
 68
+    if removed:
 69
+        hookenv.log('{} missing packages ({})'.format(len(removed),
 70
+                                                      ','.join(removed)),
 71
+                    WARNING)
 72
+        for package in removed:
 73
+            reactive.remove_state('apt.installed.{}'.format(package))
 74
+
 75
+
 76
+def configure_sources():
 77
+    """Add user specified package sources from the service configuration.
 78
+
 79
+    See charmhelpers.fetch.configure_sources for details.
 80
+    """
 81
+    config = hookenv.config()
 82
+
 83
+    # We don't have enums, so we need to validate this ourselves.
 84
+    package_status = config.get('package_status')
 85
+    if package_status not in ('hold', 'install'):
 86
+        charms.apt.status_set('blocked',
 87
+                              'Unknown package_status {}'
 88
+                              ''.format(package_status))
 89
+        # Die before further hooks are run. This isn't very nice, but
 90
+        # there is no other way to inform the operator that they have
 91
+        # invalid configuration.
 92
+        raise SystemExit(0)
 93
+
 94
+    sources = config.get('install_sources')
 95
+    keys = config.get('install_keys')
 96
+    if reactive.helpers.data_changed('apt.configure_sources', (sources, keys)):
 97
+        fetch.configure_sources(update=False,
 98
+                                sources_var='install_sources',
 99
+                                keys_var='install_keys')
100
+        reactive.set_state('apt.needs_update')
101
+
102
+    extra_packages = sorted(config.get('extra_packages', '').split())
103
+    if extra_packages:
104
+        charms.apt.queue_install(extra_packages)
105
+
106
+
107
+def queue_layer_packages():
108
+    """Add packages listed in build-time layer options."""
109
+    # Both basic and apt layer. basic layer will have already installed
110
+    # its defined packages, but rescheduling it here gets the apt layer
111
+    # state set and they will pinned as any other apt layer installed
112
+    # package.
113
+    opts = layer.options()
114
+    for section in ['basic', 'apt']:
115
+        if section in opts and 'packages' in opts[section]:
116
+            charms.apt.queue_install(opts[section]['packages'])
117
+
118
+
119
+# Per https://github.com/juju-solutions/charms.reactive/issues/33,
120
+# this module may be imported multiple times so ensure the
121
+# initialization hook is only registered once. I have to piggy back
122
+# onto the namespace of a module imported before reactive discovery
123
+# to do this.
124
+if not hasattr(reactive, '_apt_registered'):
125
+    # We need to register this to run every hook, not just during install
126
+    # and config-changed, to protect against race conditions. If we don't
127
+    # do this, then the config in the hook environment may show updates
128
+    # to running hooks well before the config-changed hook has been invoked
129
+    # and the intialization provided an opertunity to be run.
130
+    hookenv.atstart(hookenv.log, 'Initializing Apt Layer')
131
+    hookenv.atstart(clear_removed_package_states)
132
+    hookenv.atstart(configure_sources)
133
+    hookenv.atstart(queue_layer_packages)
134
+    reactive._apt_registered = True
Back to file index

reactive/ibm-base.sh

  1
--- 
  2
+++ reactive/ibm-base.sh
  3
@@ -0,0 +1,107 @@
  4
+#!/bin/bash
  5
+source charms.reactive.sh
  6
+set -e
  7
+
  8
+
  9
+# Utility function to verify a downloaded resource
 10
+# :param: file name
 11
+# :param: checksum type
 12
+# :param: checksum value
 13
+function verify_curl_resource() {
 14
+  local FILE=$1
 15
+  local TYPE=$2
 16
+  local EXPECTED_SUM=$3
 17
+  local CALCULATED_SUM=""
 18
+  local PROG=""
 19
+
 20
+  if [ ! -r ${FILE} ]; then
 21
+    status-set blocked "ibm-base: could not read ${FILE}"
 22
+    juju-log "Could not verify the downloaded resource. File could not be read: ${FILE}"
 23
+  fi
 24
+
 25
+  # Set our checksum utility based on the requested type
 26
+  case "${TYPE}" in
 27
+    md5)
 28
+      PROG='md5sum'
 29
+      ;;
 30
+    sha256)
 31
+      PROG='sha256sum'
 32
+      ;;
 33
+    sha512)
 34
+      PROG='sha512sum'
 35
+      ;;
 36
+    *)
 37
+      status-set blocked "ibm-base: checksum type must be md5, sha215, or sha512"
 38
+      juju-log "Could not verify the downloaded resource ${FILE}. Unknown checksum type: ${TYPE}"
 39
+      return 1
 40
+  esac
 41
+
 42
+  CALCULATED_SUM=`${PROG} ${FILE} | awk '{print $1}'`
 43
+  if [ "${CALCULATED_SUM}" = "${EXPECTED_SUM}" ]; then
 44
+    juju-log "Checksum verified for ${FILE}."
 45
+    return 0
 46
+  else
 47
+    status-set blocked "ibm-base: checksums did not match"
 48
+    juju-log "Checksum mismatch for ${FILE}. Expected ${EXPECTED_SUM}, got ${CALCULATED_SUM}"
 49
+    return 1
 50
+  fi
 51
+}
 52
+
 53
+
 54
+# Fetch curl resources if a URL is configured
 55
+@when 'config.set.curl_url'
 56
+@when_any 'config.new.curl_url' 'config.changed.curl_url' 'config.new.curl_opts' 'config.changed.curl_opts'
 57
+function fetch_curl_resource() {
 58
+  local ARCHIVE_DIR="${CHARM_DIR}/files/archives"
 59
+  local CURL_URL=$(config-get 'curl_url')
 60
+  local CURL_OPTS=$(config-get 'curl_opts')
 61
+
 62
+  status-set maintenance "ibm-base: fetching resource(s)"
 63
+
 64
+  mkdir -p ${ARCHIVE_DIR}
 65
+  cd ${ARCHIVE_DIR}
 66
+  # Multiple URLs may be separated by a space, so loop.
 67
+  for URL_STRING in ${CURL_URL}
 68
+  do
 69
+    # For each URL_STRING, set the url, checksum type, and checksum value.
 70
+    local URL=${URL_STRING%%\?*}        # string before the first '?'
 71
+    local FILE_NAME=${URL##*\/}         # string after the last '/'
 72
+    local SUM_STRING=${URL_STRING#*\?}  # string after the first '?'
 73
+    local SUM_TYPE=${SUM_STRING%%\=*}   # string before the first '='
 74
+    local SUM_VALUE=${SUM_STRING#*\=}   # string after the first '='
 75
+
 76
+    if [ -z ${FILE_NAME} ]; then
 77
+      FILE_NAME="juju-${RANDOM}"
 78
+    fi
 79
+    curl --silent --show-error ${CURL_OPTS} -o ${FILE_NAME} ${URL}
 80
+
 81
+    # Verify our resource checksum. If this fails, let verify_resource log
 82
+    # the reason and exit successfully. Exiting non-zero would fail the hook,
 83
+    # so return 0 and simply inform the user that verification failed.
 84
+    verify_curl_resource ${FILE_NAME} ${SUM_TYPE} ${SUM_VALUE} || return 0
 85
+  done
 86
+  cd -
 87
+
 88
+  set_state 'ibm-base.curl.resource.fetched'
 89
+  status-set active "ibm-base: curl resource(s) fetched"
 90
+  juju-log 'Curl resource fetched'
 91
+}
 92
+
 93
+
 94
+# Handle license acceptance
 95
+@when 'config.changed.license_accepted'
 96
+function check_license_acceptance() {
 97
+  local LIC_ACCEPTED=$(config-get 'license_accepted')
 98
+
 99
+  # compare lowercase LIC_ACCEPTED (requires bash > 4)
100
+  if [ "${LIC_ACCEPTED,,}" = "true" ]; then
101
+    set_state 'ibm-base.license.accepted'
102
+    juju-log 'License accepted'
103
+  else
104
+    remove_state 'ibm-base.license.accepted'
105
+    juju-log 'License NOT accepted'
106
+  fi
107
+}
108
+
109
+# Main reactive entry point
110
+reactive_handler_main
Back to file index

reactive/ibm-im.sh

  1
--- 
  2
+++ reactive/ibm-im.sh
  3
@@ -0,0 +1,187 @@
  4
+#!/bin/bash
  5
+set -e
  6
+
  7
+source charms.reactive.sh
  8
+ARCHITECTURE=`uname -m`
  9
+
 10
+# Installation Manager install path
 11
+IM_INSTALL_PATH="/opt/IBM/InstallationManager"
 12
+
 13
+@when_not 'ibm-im.installed'
 14
+function install_ibm_im(){
 15
+      # Fail fast if we're on an unsupported arch
 16
+      if [ "$ARCHITECTURE" != "x86_64" -a  "$ARCHITECTURE" != "ppc64le" ]; then
 17
+            juju-log "IBM IM: only supported on x86_64 or ppc64le platforms"
 18
+            status-set blocked "unsupported architecture"
 19
+            exit 1
 20
+      fi
 21
+
 22
+      # Get the installable resource
 23
+      juju-log "IBM IM: fetching the ibm_im_installer resource"
 24
+      status-set maintenance "fetching the ibm_im_installer resource"
 25
+      cfg_im_pkg_name=`resource-get 'ibm_im_installer' || echo unavailable`
 26
+
 27
+      # If we don't have a package, report blocked status; we can't proceed.
 28
+      if [ "$cfg_im_pkg_name" = "unavailable" ]; then
 29
+        juju-log "IBM IM: missing required ibm_im_installer resource"
 30
+        status-set blocked "missing required ibm_im_installer resource"
 31
+        exit 0
 32
+      fi
 33
+
 34
+      juju-log "IBM IM: using $cfg_im_pkg_name as the ibm_im_installer resource"
 35
+      ARCHIVE_DIR=`dirname $cfg_im_pkg_name`
 36
+
 37
+      # Extract the installer contents
 38
+      if [ -f  $cfg_im_pkg_name ]; then
 39
+           juju-log "IBM IM: extracting the ibm_im_installer resource"
 40
+           status-set maintenance "extracting the ibm_im_installer resource"
 41
+           if [ -f $ARCHIVE_DIR/userinstc ]; then
 42
+                 juju-log "IBM IM: ibm_im_installer resource already extracted"
 43
+           else
 44
+                 cd $ARCHIVE_DIR
 45
+                 if ! unzip $cfg_im_pkg_name; then
 46
+                      juju-log "IBM IM: Unable to extract the ibm_im_installer resource"
 47
+                      # Remove corrupt archive file
 48
+                      status-set blocked "ibm_im_installer resource is corrupt"
 49
+                      rm -rf $ARCHIVE_DIR
 50
+                      exit 0
 51
+                 else
 52
+                      juju-log "IBM IM: ibm_im_installer resource extracted successfully"
 53
+                 fi
 54
+           fi
 55
+      fi
 56
+
 57
+      # Do the actual IBM IM install
 58
+      if [ -f  $ARCHIVE_DIR/userinstc ]; then
 59
+        juju-log "IBM IM: starting installation."
 60
+        status-set maintenance "installing ibm-im"
 61
+        cp $ARCHIVE_DIR/install.xml $ARCHIVE_DIR/silent_install.xml
 62
+        sed -i "2 a \<profile kind='self' installLocation='$IM_INSTALL_PATH' id='IBM Installation Manager'>\n <data key='eclipseLocation' value='$IM_INSTALL_PATH' />\n</profile>" $ARCHIVE_DIR/silent_install.xml
 63
+        if $ARCHIVE_DIR/userinstc -input $ARCHIVE_DIR/silent_install.xml -acceptlicense; then
 64
+            set_state 'ibm-im.installed'
 65
+            status-set active "ready"
 66
+        else
 67
+            juju-log "IBM IM: error while installing"
 68
+            exit 1
 69
+        fi
 70
+      else
 71
+        juju-log "IBM IM: installer was not found."
 72
+        status-set blocked "installation failed"
 73
+        exit 1
 74
+      fi
 75
+}
 76
+
 77
+@when 'ibm-im.installed'
 78
+@when_not 'ibm-im.updated'
 79
+function install_ibm_im_fixpack(){
 80
+    # Get the fixpack resource
 81
+    juju-log "IBM IM: fetching the ibm_im_fixpack resource"
 82
+    status-set maintenance "fetching the ibm_im_fixpack resource"
 83
+    ibm_im_fp_package=`resource-get 'ibm_im_fixpack' || echo unavailable`
 84
+
 85
+    # If we don't have a fixpack, just exit successfully; there's nothing to do.
 86
+    if [ "$ibm_im_fp_package" = "unavailable" ]; then
 87
+      juju-log "IBM IM: no ibm_im_fixpack to install"
 88
+      status-set active "ready"
 89
+      exit 0
 90
+    fi
 91
+
 92
+    # Currently, there is no way to make a resource optional, so something
 93
+    # must be uploaded to the charm store, even if it's a dummy archive.
 94
+    # If we detect the fixpack is just a placeholder (because we created an
 95
+    # empty placeholder in the store), exit just like we do with a missing
 96
+    # fixpack resource.
 97
+    ibm_im_fp_empty=`file $ibm_im_fp_package | { grep -q empty && echo "True"; } || echo "False"`
 98
+    if [ "$ibm_im_fp_empty" = "True" ]; then
 99
+      juju-log "IBM IM: no ibm_im_fixpack to install"
100
+      status-set active "ready"
101
+      exit 0
102
+    fi
103
+
104
+    juju-log "IBM IM: using $ibm_im_fp_package as the ibm_im_fixpack resource"
105
+    ARCHIVE_DIR=`dirname $ibm_im_fp_package`
106
+
107
+    # Extract the fixpack contents
108
+    if [ -f $ibm_im_fp_package ]; then
109
+        juju-log "IBM IM: extracting the ibm_im_fixpack resource"
110
+        status-set maintenance "extracting the ibm_im_fixpack resource"
111
+        if [ -f $ARCHIVE_DIR/userinstc ]; then
112
+              juju-log "IBM IM: ibm_im_fixpack resource already extracted"
113
+        else
114
+              cd $ARCHIVE_DIR
115
+              if ! unzip $ibm_im_fp_package; then
116
+                      juju-log "IBM IM: Unable to extract the ibm_im_fixpack resource"
117
+                      # Remove corrupt archive file
118
+                      status-set blocked "ibm_im_fixpack resource is corrupt"
119
+                      rm  -rf $ARCHIVE_DIR
120
+                      exit 0
121
+              else
122
+                      juju-log "IBM IM: ibm_im_fixpack resource extracted successfully"
123
+              fi
124
+        fi
125
+    fi
126
+
127
+    # Do the actual IBM IM fixpack install
128
+    if [ -f $ARCHIVE_DIR/userinstc ]; then
129
+        juju-log "IBM IM: starting fixpack installation."
130
+        status-set maintenance "installing fixpack"
131
+        cp $ARCHIVE_DIR/install.xml $ARCHIVE_DIR/silent_install.xml
132
+        sed -i "2 a \<profile kind='self' installLocation='$IM_INSTALL_PATH' id='IBM Installation Manager'>\n <data key='eclipseLocation' value='$IM_INSTALL_PATH' />\n</profile>" $ARCHIVE_DIR/silent_install.xml
133
+        if $ARCHIVE_DIR/userinstc -input $ARCHIVE_DIR/silent_install.xml -acceptlicense; then
134
+             set_state 'ibm-im.updated'
135
+             status-set active "ready"
136
+        else
137
+             juju-log "IBM IM: error while installing the fixpack."
138
+             exit 1
139
+        fi
140
+    else
141
+        juju-log "IBM_IM: Fix pack installer was not found."
142
+        status-set blocked "fixpack installation failed"
143
+        exit 1
144
+   fi
145
+}
146
+
147
+@hook 'upgrade-charm'
148
+function check_fixpack(){
149
+    # The upgrade-charm hook will fire when a new resource is pushed for this
150
+    # charm. This is a good time to determine if we need to deal with a new
151
+    # fixpack.
152
+    if ! charms.reactive is_state 'ibm-im.updated'; then
153
+        # If there is no prior fixpack installed (because ibm-im.updated is not
154
+        # set), do nothing since install-ibm-im-fixpack will handle that case.
155
+        juju-log "IBM IM: no fixpack has been installed; nothing to upgrade."
156
+        exit 0
157
+    else
158
+        # If we have a fixpack already (because ibm-im.updated is set),
159
+        # we should fetch the latest fixpack and determine if it is new.
160
+        #  - If it is new, set our states so install-ibm-im-fixpack is called again
161
+        #  - If it is not new, do nothing
162
+        juju-log "IBM IM: scanning for new fixpacks to install"
163
+        ARCHIVE_DIR="$CHARM_DIR/../resources/ibm_im_fixpack"
164
+        CUR_FIXPACK="$ARCHIVE_DIR/ibm_im_fixpack.zip"
165
+
166
+        # Sum any existing fixpack to determine if we have a new one
167
+        if [ -f $CUR_FIXPACK ]; then
168
+            CUR_MD5=`md5sum "$CUR_FIXPACK" | awk '{print $1}'`
169
+            # Calling resource-get here will fetch the fixpack resource.
170
+            NEW_FIXPACK=`resource-get 'ibm_im_fixpack' || echo unavailable`
171
+            if [ "$NEW_FIXPACK" = "unavailable" ]; then
172
+                juju-log "IBM IM: no fixpack to install"
173
+            else
174
+                NEW_MD5=`md5sum "$NEW_FIXPACK" | awk '{print $1}'`
175
+                # If sums don't match, we have a new fp. Configure states so
176
+                # we re-run install-ibm-im-fixpack().
177
+                if [ "$CUR_MD5" != "$NEW_MD5" ]; then
178
+                    juju-log "IBM IM: new fixpack detected ($CUR_FIXPACK with $CUR_MD5 versus $NEW_FIXPACK with $NEW_MD5)"
179
+                    rm -rf $ARCHIVE_DIR
180
+                    remove_state 'ibm-im.updated'
181
+                else
182
+                    juju-log "IBM IM: no new fixpack to install"
183
+                fi
184
+            fi
185
+        fi
186
+    fi
187
+}
188
+
189
+
190
+reactive_handler_main
Back to file index

reactive/ibm-was-nd-node.sh

  1
--- 
  2
+++ reactive/ibm-was-nd-node.sh
  3
@@ -0,0 +1,235 @@
  4
+#!/bin/bash
  5
+set -ex
  6
+
  7
+source charms.reactive.sh
  8
+reactive_states=`charms.reactive -y get_states`
  9
+
 10
+WAS_ND_INSTALL_PATH=/root/IBM/WebSphere/AppServer/V85/ND
 11
+IM_INSTALL_PATH=/opt/IBM/InstallationManager
 12
+profile_template_path="$WAS_ND_INSTALL_PATH/profileTemplates/default"
 13
+hostname=`unit-get private-address`
 14
+ARCHITECTURE=`uname -m`
 15
+dm_username=""
 16
+dm_password=""
 17
+juju-log "IBM WAS ND Node: host name is $hostname"
 18
+profile_name="_profile"
 19
+profile_name=$hostname$profile_name
 20
+juju-log "profile name is $profile_name"
 21
+
 22
+if [ -f $CHARM_DIR/files/dm_credentials.txt ]; then
 23
+		source $CHARM_DIR/files/dm_credentials.txt
 24
+		dm_username=$username
 25
+		dm_password=$password
 26
+fi
 27
+
 28
+install_was_nd_fixpack() {
 29
+	if [ "$ARCHITECTURE" == "x86_64" ];then
 30
+		if $IM_INSTALL_PATH/eclipse/tools/imcl install com.ibm.websphere.ND.v85 -acceptLicense -repositories $CHARM_DIR/../resources/WAS_ND/FP -installationDirectory $WAS_ND_INSTALL_PATH  -showProgress
 31
+		then
 32
+			set_state 'ibm-was-nd-node.updated'
 33
+			status-set active "IBM WAS ND: WAS ND installation upgraded successfully!"
 34
+		else
 35
+			status-set blocked "IBM WAS ND: Error while upgrading WAS ND!"
 36
+			return 1
 37
+		fi
 38
+                          
 39
+	elif [ "$ARCHITECTURE" == "ppc64le" ];then
 40
+		if $IM_INSTALL_PATH/eclipse/tools/imcl install com.ibm.websphere.ND.le.v85 -acceptLicense -repositories $CHARM_DIR/../resources/WAS_ND/FP -installationDirectory $WAS_ND_INSTALL_PATH  -showProgress
 41
+		then
 42
+			set_state 'ibm-was-nd-node.updated'
 43
+			status-set active "IBM WAS ND: WAS ND installation upgraded successfully!"
 44
+		else
 45
+			status-set blocked "IBM WAS ND: Error while upgrading WAS ND!"
 46
+			return 1
 47
+		fi
 48
+	fi
 49
+}
 50
+
 51
+@when 'ibm-was-nd.installed'
 52
+@when_not 'ibm-was-nd-node.profile.ready'
 53
+function create_default_profile(){
 54
+	juju-log "IBM WAS ND Node: Creating custom profile to federate."
 55
+	$WAS_ND_INSTALL_PATH/bin/manageprofiles.sh -create -profileName $profile_name -templatePath $profile_template_path 
 56
+	juju-log "IBM WAS ND Node: Profile creation completed."
 57
+	set_state 'ibm-was-nd-node.profile.ready'
 58
+}
 59
+
 60
+@when 'ibm-was-nd.installed'
 61
+@when_not 'ibm-was-nd-node.updated'
 62
+function update_was_nd_node(){
 63
+	
 64
+	# Get the WAS ND fixpack resources
 65
+	juju-log "IBM WAS ND: fetching the ibm_was_nd_fp1 resource"
 66
+	status-set maintenance "fetching the ibm_was_nd_fp1 resource"
 67
+	was_nd_fp1=`resource-get 'ibm_was_nd_fp1' || echo unavailable`
 68
+		
 69
+	juju-log "IBM WAS ND: fetching the ibm_was_nd_fp2 resource"
 70
+	status-set maintenance "fetching the ibm_was_nd_fp2 resource"
 71
+	was_nd_fp2=`resource-get 'ibm_was_nd_fp2' || echo unavailable`
 72
+		
 73
+	#If we don't have a fixpack, just exit successfully; there's nothing to do.
 74
+	if [ "$was_nd_fp1" = "unavailable" -o "$was_nd_fp2" = "unavailable" ]; then
 75
+		juju-log "IBM WAS ND: no ibm_was_nd_fixpack packages to install"
 76
+		status-set active "IBM WAS ND is ready"
 77
+		return 0
 78
+	fi
 79
+	
 80
+	#If we detect the fixpack is just a placeholder in charm store, just exit successfully; there's nothing to do.
 81
+	ibm_was_fp1_isempty=`file $was_nd_fp1 | { grep -q empty && echo "True"; } || echo "False"`
 82
+	ibm_was_fp2_isempty=`file $was_nd_fp2 | { grep -q empty && echo "True"; } || echo "False"`
 83
+	if [ "$ibm_was_fp1_isempty" = "True" -o "$ibm_was_fp2_isempty" = "True" ]; then
 84
+		juju-log "IBM WAS ND: no ibm_was_nd_fixpack packages to install $was_nd_fp1 $was_nd_fp2 are empty"
 85
+		status-set active "IBM WAS ND is ready"
 86
+		return 0
 87
+	fi
 88
+	was_fixpack_packages="$was_nd_fp1 $was_nd_fp2"
 89
+	juju-log "IBM WAS ND: Fixpacks provided for upgrade $was_fixpack_packages"
 90
+	
 91
+	if [ ! -d $CHARM_DIR/../resources/WAS_ND/FP ]; then
 92
+		mkdir $CHARM_DIR/../resources/WAS_ND/FP
 93
+	fi
 94
+	
 95
+	for was_fp_pkg in $was_fixpack_packages; do
 96
+		juju-log "was_fp_pkg====="$was_fp_pkg
 97
+		if [ -f $was_fp_pkg ]; then
 98
+			ARCHIVE_DIR=`dirname $was_fp_pkg`
 99
+			juju-log "IBM WAS ND: extracting the ibm_was_nd_fp resources"
100
+			status-set maintenance "extracting the ibm_was_nd_fp resources"
101
+			if ! unzip $was_fp_pkg -d $ARCHIVE_DIR/../WAS_ND/FP
102
+				then
103
+					juju-log "IBM WAS ND: Unable to extract the WAS ND fixpack content. Verify whether the package is corrupt."
104
+					# Remove corrupt archive file
105
+					status-set blocked "IBM WAS ND packages are corrupt"
106
+					rm -rf $ARCHIVE_DIR/../WAS_ND/FP
107
+					exit 0
108
+			else
109
+				juju-log "IBM WAS ND: $was_fp_pkg extracted successfully"
110
+			fi
111
+		fi
112
+	done
113
+	if charms.reactive is_state 'ibm-was-nd-node.added'; then
114
+		remove_from_cluster
115
+	fi
116
+
117
+	install_was_nd_fixpack
118
+}
119
+
120
+@hook 'upgrade-charm'
121
+function check_fixpack(){
122
+	# The upgrade-charm hook will fire when a new resource is pushed for this
123
+	# charm. This is a good time to determine if we need to deal with a new
124
+	# fixpack.
125
+	if ! charms.reactive is_state 'ibm-was-nd-node.updated'; then
126
+		# If there is no prior fixpack installed (because ibm-was-nd-node.updated is not
127
+		# set), do nothing since update_was_nd_node will handle that case.
128
+		juju-log "IBM WAS ND: no fixpack has been installed; nothing to upgrade."
129
+		return 0
130
+	else
131
+		# If we have a fixpack packges already (because ibm-was-nd.updated is set),
132
+		# we should fetch the latest fixpack packages and determine if it is new.
133
+		#  - If it is new, set our states so install_was_nd_fixpack is called again
134
+		#  - If it is not new, do nothing
135
+		juju-log "IBM WAS ND: scanning for new fixpacks to install"
136
+		WAS_FP1_DIR="$CHARM_DIR/../resources/ibm_was_nd_fp1"
137
+		WAS_FP2_DIR="$CHARM_DIR/../resources/ibm_was_nd_fp2"
138
+		CUR_FP1="$WAS_FP1_DIR/ibm_was_nd_fp1.zip"
139
+		CUR_FP2="$WAS_FP2_DIR/ibm_was_nd_fp2.zip"
140
+		if [ -f $CUR_FP1 -a -f  $CUR_FP2 ]; then
141
+			CUR_FP1_MD5=`md5sum "$CUR_FP1" | awk '{print $1}'`
142
+			CUR_FP2_MD5=`md5sum "$CUR_FP2" | awk '{print $1}'`
143
+		fi
144
+		NEW_FP1=`resource-get 'ibm_was_nd_fp1' || echo unavailable`
145
+		NEW_FP2=`resource-get 'ibm_was_nd_fp2' || echo unavailable`
146
+		
147
+		if [ "$NEW_FP1" = "unavailable" -o "$NEW_FP2" = "unavailable" ]; then
148
+			juju-log "IBM WAS ND: no fixpacks to install"
149
+		elif [ -f $NEW_FP1 -a -f  $NEW_FP2 ]; then
150
+			NEW_FP1_MD5=`md5sum "$NEW_FP1" | awk '{print $1}'`
151
+			NEW_FP2_MD5=`md5sum "$NEW_FP2" | awk '{print $1}'`
152
+		fi
153
+		
154
+		if [ "$CUR_FP1_MD5" != "$NEW_FP1_MD5" -o "$CUR_FP2_MD5" != "$NEW_FP2_MD5" ]; then
155
+			juju-log "IBM WAS ND: new fixpack detected ($CUR_FP1 with $CUR_FP1_MD5 versus $NEW_FP1 with $NEW_FP1_MD5 and $CUR_FP2 with $CUR_FP2_MD5 versus $NEW_FP2 with $NEW_FP2_MD5)"
156
+			rm -rf $CHARM_DIR/../resources/WAS_ND/FP
157
+			remove_state 'ibm-was-nd-node.updated'
158
+		else
159
+			juju-log "IBM WAS ND: no new fixpack to install"
160
+		fi
161
+	fi
162
+}
163
+
164
+@when 'ibm-was-nd-node.profile.ready' 'cluster-node.connected'
165
+@when_not 'ibm-was-nd-node.hostname.set'
166
+function set_node_host_name(){
167
+	node_host_name=`hostname`
168
+	relation_call --state=cluster-node.connected set_was_node_hostname $node_host_name || true
169
+	set_state 'ibm-was-nd-node.hostname.set'
170
+}
171
+
172
+@when 'ibm-was-nd-node.profile.ready' 'cluster-node.ready'
173
+@when_not 'ibm-was-nd-node.added'
174
+function add_was_nd_node(){
175
+	juju-log "*******In add_was_nd_node reactive function of WAS ND Node charm*******"
176
+	dm_host=$(relation_call --state=cluster-node.connected get_was_dm_hostname) || true
177
+	dm_ip=$(relation_call --state=cluster-node.connected get_was_dm_ip) || true
178
+	juju-log "I got the dm host name $dm_host $dm_ip"
179
+	if [ "$dm_host" == "None" ]; then
180
+		juju-log "IBM WAS Node: Waiting for the data......."
181
+		return 0
182
+	else
183
+	juju-log "IBM WAS ND Node: got dmgr host $dm_host $dm_ip"
184
+	cd /etc
185
+		if grep -q "$dm_ip $dm_host" hosts
186
+		then
187
+			juju-log "IBM WAS ND Node: Host file already updated"
188
+		else
189
+			juju-log "IBM WAS ND Node: Updating Host file"
190
+			echo "$dm_ip $dm_host" >> /etc/hosts
191
+		fi
192
+	fi
193
+	dm_username=$(relation_call --state=cluster-node.connected get_dmgradminuser) || true
194
+	juju-log "I got the dm user name $dm_username"
195
+	dm_password=$(relation_call --state=cluster-node.connected get_dmgrpwd) || true
196
+	juju-log "I got the dm password $dm_password"
197
+	if [ ! -d $CHARM_DIR/files ]; then
198
+		mkdir $CHARM_DIR/files
199
+	fi
200
+	if [ ! -f $CHARM_DIR/files/dm_credentials.txt ]; then
201
+		touch $CHARM_DIR/files/dm_credentials.txt
202
+		echo "username=$dm_username" >> $CHARM_DIR/files/dm_credentials.txt
203
+		echo "password=$dm_password" >> $CHARM_DIR/files/dm_credentials.txt
204
+	fi
205
+	if $WAS_ND_INSTALL_PATH/profiles/$profile_name/bin/addNode.sh $dm_host -username $dm_username -password $dm_password
206
+	then
207
+		$WAS_ND_INSTALL_PATH/profiles/$profile_name/bin/startServer.sh server1
208
+		juju-log "Profile Federated to deployment manager."
209
+		set_state 'ibm-was-nd-node.added'
210
+	else
211
+		juju-log "IBM WAS ND Node: Error occured while adding node to the deployment manager."
212
+		return 1
213
+	fi
214
+}
215
+
216
+@when 'cluster-node.departed'
217
+function remove_from_cluster(){
218
+	juju-log "*******In remove_from_cluster reactive function of WAS ND Node charm*******"
219
+	juju-log "Removing Federated profile from deployment manager cell"
220
+	#dm_username=$(relation_call --state=cluster-node.departed get_dmgradminuser) || true
221
+	juju-log "I got the dm user name $dm_username"
222
+	#dm_password=$(relation_call --state=cluster-node.departed get_dmgrpwd) || true
223
+	juju-log "I got the dm password $dm_password"
224
+	if [ -f $CHARM_DIR/files/dm_credentials.txt ]
225
+	then
226
+		if $WAS_ND_INSTALL_PATH/profiles/$profile_name/bin/removeNode.sh -username $dm_username -password $dm_password
227
+		then
228
+			juju-log "Removed Federated profile from deployment manager cell"
229
+			rm -rf $CHARM_DIR/files/dm_credentials.txt
230
+		else
231
+			juju-log "IBM WAS ND Node: Error occured while removing node from the deployment manager."
232
+			return 1
233
+		fi
234
+		remove_state 'ibm-was-nd-node.added'
235
+	fi
236
+}
237
+reactive_handler_main
238
+
Back to file index

reactive/ibm-was-nd.sh

  1
--- 
  2
+++ reactive/ibm-was-nd.sh
  3
@@ -0,0 +1,135 @@
  4
+#!/bin/bash
  5
+set -ex
  6
+
  7
+source charms.reactive.sh
  8
+
  9
+reactive_states=`charms.reactive -y get_states`
 10
+
 11
+WAS_ND_INSTALL_PATH=/root/IBM/WebSphere/AppServer/V85/ND
 12
+IM_INSTALL_PATH=/opt/IBM/InstallationManager
 13
+ARCHITECTURE=`uname -m`
 14
+
 15
+if [ "$ARCHITECTURE" != "x86_64" -a  "$ARCHITECTURE" != "ppc64le" ]; then
 16
+	juju-log "IBM WAS ND: Unsupported platform. IBM WAS ND installed with this Charm supports only the x86_64 and ppc64le platforms."
 17
+	status-set blocked "IBM WAS ND: Unsupported architecture"
 18
+	exit 1
 19
+fi
 20
+
 21
+@when 'ibm-im.installed'
 22
+@when_not 'ibm-was-nd.installed'
 23
+function install_WAS_ND() {
 24
+	juju-log "IBM WAS ND: Checking etc/hosts file."
 25
+	private_address=`unit-get private-address`
 26
+	juju-log "private_address : $private_address"
 27
+	cd /etc
 28
+	if grep -q "$private_address" hosts
 29
+	then
 30
+		juju-log "IBM WAS ND: Host file already updated"
 31
+	else
 32
+		juju-log "IBM WAS ND: Updating Host file"
 33
+		echo "$private_address `hostname`" >> /etc/hosts
 34
+	fi
 35
+
 36
+	# Get the installable WAS ND resources
 37
+	juju-log "IBM WAS ND: fetching the ibm_was_nd_installer1 resource"
 38
+	status-set maintenance "fetching the ibm_was_nd_installer1 resource"
 39
+	cfg_was_nd_pkg1_name=`resource-get 'ibm_was_nd_installer1' || echo unavailable`
 40
+	
 41
+	juju-log "IBM WAS ND: fetching the ibm_was_nd_installer2 resource"
 42
+	status-set maintenance "fetching the ibm_was_nd_installer2 resource"
 43
+	cfg_was_nd_pkg2_name=`resource-get 'ibm_was_nd_installer2' || echo unavailable`
 44
+	
 45
+	ibm_was_pkg1_isempty=`file $cfg_was_nd_pkg1_name | { grep -q empty && echo "True"; } || echo "False"`
 46
+	ibm_was_pkg2_isempty=`file $cfg_was_nd_pkg2_name | { grep -q empty && echo "True"; } || echo "False"`
 47
+	if [ "$ARCHITECTURE" == "x86_64" ];then
 48
+		juju-log "IBM WAS ND: fetching the ibm_was_nd_installer3 resource"
 49
+		status-set maintenance "fetching the ibm_was_nd_installer3 resource"
 50
+		cfg_was_nd_pkg3_name=`resource-get 'ibm_was_nd_installer3' || echo unavailable`
 51
+		ibm_was_pkg3_isempty=`file $cfg_was_nd_pkg3_name | { grep -q empty && echo "True"; } || echo "False"`	  
 52
+		# If we don't have a package, report blocked status; we can't proceed.
 53
+		if [ "$cfg_was_nd_pkg1_name" = "unavailable" -o "$cfg_was_nd_pkg2_name" = "unavailable" -o "$cfg_was_nd_pkg3_name" = "unavailable" ]; then
 54
+			juju-log "IBM WAS ND: missing required ibm_was_nd_installer resource"
 55
+			status-set blocked "missing required ibm_was_nd_installer resource"
 56
+			return 0
 57
+		fi
 58
+		
 59
+		if [ "$ibm_was_pkg1_isempty" = "True" -o "$ibm_was_pkg2_isempty" = "True" -o "$ibm_was_pkg3_isempty" = "True" ]; then
 60
+			juju-log "IBM WAS ND: missing required ibm_was_nd_installer resource, found empty packages"
 61
+			status-set blocked "missing required ibm_was_nd_installer resource, provide actual ibm_was_nd_installer resources."
 62
+			return 0
 63
+		fi
 64
+		
 65
+	elif [ "$ARCHITECTURE" == "ppc64le" ];then
 66
+		# If we don't have a package, report blocked status; we can't proceed.
 67
+		if [ "$cfg_was_nd_pkg1_name" = "unavailable" -o "$cfg_was_nd_pkg2_name" = "unavailable" ]; then
 68
+			juju-log "IBM WAS ND: missing required ibm_was_nd_installer resource"
 69
+			status-set blocked "missing required ibm_was_nd_installer resource"
 70
+			return 0
 71
+		fi
 72
+		if [ "$ibm_was_pkg1_isempty" = "True" -o "$ibm_was_pkg2_isempty" = "True" ]; then
 73
+			juju-log "IBM WAS ND: missing required ibm_was_nd_installer resource, found empty packages"
 74
+			status-set blocked "missing required ibm_was_nd_installer resource, provide actual ibm_was_nd_installer resources."
 75
+			return 0
 76
+		fi
 77
+	fi
 78
+	
 79
+	juju-log "IBM WAS ND: using $cfg_was_nd_pkg1_name $cfg_was_nd_pkg2_name $cfg_was_nd_pkg3_name as the ibm_was_nd_installer resources"
 80
+	was_nd_installers="$cfg_was_nd_pkg1_name $cfg_was_nd_pkg2_name $cfg_was_nd_pkg3_name"
 81
+	juju-log "IBM WAS ND: was_nd_installers===$was_nd_installers"
 82
+	
 83
+	for was_pkg in $was_nd_installers; do
 84
+		juju-log "IBM WAS ND: was_pkg====="$was_pkg
 85
+		if [ -f $was_pkg ]; then
 86
+			ARCHIVE_DIR=`dirname $was_pkg`
 87
+			juju-log "IBM WAS ND: extracting the ibm_was_nd_installer resources"
 88
+			status-set maintenance "extracting the ibm_was_nd_installer resource"
 89
+			if [ -d $ARCHIVE_DIR/../WAS_ND/disk1 -a -d $ARCHIVE_DIR/../WAS_ND/disk2 -a -d $ARCHIVE_DIR/../WAS_ND/disk3 ];then
 90
+				juju-log "IBM WAS ND: ibm_was_nd_installer resources already extracted"
 91
+			else
 92
+				if [ ! -d $ARCHIVE_DIR/../WAS_ND ]; then
 93
+					mkdir $ARCHIVE_DIR/../WAS_ND
 94
+				fi				
 95
+				if ! unzip $was_pkg -d $ARCHIVE_DIR/../WAS_ND
 96
+				then
 97
+					juju-log "IBM WAS ND: Unable to extract the WAS ND packages content. Verify whether the package is corrupt."
 98
+					# Remove corrupt archive file
 99
+					status-set blocked "IBM WAS ND packages are corrupt"
100
+					rm -rf $ARCHIVE_DIR/../WAS_ND 
101
+					return 0
102
+				else
103
+					juju-log "IBM WAS ND: $was_pkg extracted successfully"
104
+				fi
105
+			fi
106
+		fi
107
+	done
108
+	
109
+	juju-log "IBM WAS ND: starting WAS ND installation."
110
+	status-set maintenance "IBM WAS ND: Installing WAS ND"
111
+	#sh does not work in ubuntu so linking to bash
112
+	juju-log "IBM WAS ND: Unlink /bin/sh"
113
+	unlink /bin/sh
114
+	ln -s /bin/bash /bin/sh
115
+	if [ "$ARCHITECTURE" == "x86_64" ];then
116
+		if $IM_INSTALL_PATH/eclipse/tools/imcl install com.ibm.websphere.ND.v85 -acceptLicense -repositories $ARCHIVE_DIR/../WAS_ND -installationDirectory $WAS_ND_INSTALL_PATH  -showProgress
117
+		then
118
+			set_state 'ibm-was-nd.installed'
119
+			status-set active "IBM WAS ND: WAS ND is installed successfully!"
120
+		else
121
+			status-set blocked "IBM WAS ND: WAS ND Installation failed!"
122
+			return 1
123
+		fi
124
+                          
125
+	elif [ "$ARCHITECTURE" == "ppc64le" ];then
126
+		if $IM_INSTALL_PATH/eclipse/tools/imcl install com.ibm.websphere.ND.le.v85 -acceptLicense -repositories $ARCHIVE_DIR/../WAS_ND -installationDirectory $WAS_ND_INSTALL_PATH  -showProgress
127
+		then
128
+			set_state 'ibm-was-nd.installed'
129
+			status-set active "IBM WAS ND: WAS ND is installed successfully!"
130
+		else
131
+			status-set blocked "IBM WAS ND: WAS ND Installation failed!"
132
+			return 1
133
+		fi
134
+	fi
135
+              
136
+}
137
+
138
+reactive_handler_main
Back to file index

reactive/leadership.py

 1
--- 
 2
+++ reactive/leadership.py
 3
@@ -0,0 +1,68 @@
 4
+# Copyright 2015-2016 Canonical Ltd.
 5
+#
 6
+# This file is part of the Leadership Layer for Juju.
 7
+#
 8
+# This program is free software: you can redistribute it and/or modify
 9
+# it under the terms of the GNU General Public License version 3, as
10
+# published by the Free Software Foundation.
11
+#
12
+# This program is distributed in the hope that it will be useful, but
13
+# WITHOUT ANY WARRANTY; without even the implied warranties of
14
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15
+# PURPOSE.  See the GNU General Public License for more details.
16
+#
17
+# You should have received a copy of the GNU General Public License
18
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+
20
+from charmhelpers.core import hookenv
21
+from charmhelpers.core import unitdata
22
+
23
+from charms import reactive
24
+from charms.leadership import leader_get, leader_set
25
+
26
+
27
+__all__ = ['leader_get', 'leader_set']  # Backwards compatibility
28
+
29
+
30
+def initialize_leadership_state():
31
+    '''Initialize leadership.* states from the hook environment.
32
+
33
+    Invoked by hookenv.atstart() so states are available in
34
+    @hook decorated handlers.
35
+    '''
36
+    is_leader = hookenv.is_leader()
37
+    if is_leader:
38
+        hookenv.log('Initializing Leadership Layer (is leader)')
39
+    else:
40
+        hookenv.log('Initializing Leadership Layer (is follower)')
41
+
42
+    reactive.helpers.toggle_state('leadership.is_leader', is_leader)
43
+
44
+    previous = unitdata.kv().getrange('leadership.settings.', strip=True)
45
+    current = hookenv.leader_get()
46
+
47
+    # Handle deletions.
48
+    for key in set(previous.keys()) - set(current.keys()):
49
+        current[key] = None
50
+
51
+    any_changed = False
52
+    for key, value in current.items():
53
+        reactive.helpers.toggle_state('leadership.changed.{}'.format(key),
54
+                                      value != previous.get(key))
55
+        if value != previous.get(key):
56
+            any_changed = True
57
+        reactive.helpers.toggle_state('leadership.set.{}'.format(key),
58
+                                      value is not None)
59
+    reactive.helpers.toggle_state('leadership.changed', any_changed)
60
+
61
+    unitdata.kv().update(current, prefix='leadership.settings.')
62
+
63
+
64
+# Per https://github.com/juju-solutions/charms.reactive/issues/33,
65
+# this module may be imported multiple times so ensure the
66
+# initialization hook is only registered once. I have to piggy back
67
+# onto the namespace of a module imported before reactive discovery
68
+# to do this.
69
+if not hasattr(reactive, '_leadership_registered'):
70
+    hookenv.atstart(initialize_leadership_state)
71
+    reactive._leadership_registered = True
Back to file index

requirements.txt

1
--- 
2
+++ requirements.txt
3
@@ -0,0 +1,2 @@
4
+flake8
5
+pytest
Back to file index

revision

1
--- 
2
+++ revision
3
@@ -0,0 +1 @@
4
+0
Back to file index

tests/01-deploy.py

 1
--- 
 2
+++ tests/01-deploy.py
 3
@@ -0,0 +1,57 @@
 4
+#!/usr/bin/env python3
 5
+
 6
+
 7
+import amulet
 8
+import re
 9
+import requests
10
+import unittest
11
+
12
+seconds_to_wait = 20000
13
+
14
+
15
+class TestDeploy(unittest.TestCase):
16
+    """
17
+    Deployment test for the IBM WAS ND Node charm.
18
+    """
19
+    def setUp(self):
20
+        self.d = amulet.Deployment(series='trusty')
21
+        self.d.add('ibm-was-nd-dm', 'cs:~ibmcharmers/trusty/ibm-was-nd-dm')
22
+        self.d.add('ibm-http', 'cs:~ibmcharmers/trusty/ibm-http')
23
+        self.d.add('ibm-was-nd-node', 'cs:~ibmcharmers/trusty/ibm-was-nd-node')
24
+        self.d.relate('ibm-was-nd-dm:dm-node', 'ibm-http:ihs')
25
+        self.d.relate('ibm-was-nd-dm:dm-node', 'ibm-was-nd-node:cluster-node')
26
+        self.d.setup(seconds_to_wait)
27
+        self.d.sentry.wait(seconds_to_wait)
28
+
29
+    def test_deploy_with_placeholder_resource(self):
30
+        # The status message when using placeholder resources will include the
31
+        # string "ibm_was_nd_installer resource". If we see that, the test is
32
+        # successful.
33
+        sentry_re = re.compile('ibm_was_nd_installer resource')
34
+        self.d.sentry.wait_for_messages({"ibm-was-nd": sentry_re})
35
+
36
+    def test_was_nd_dm_deployed(self):
37
+        self.assertTrue(self.d.deployed)
38
+        unit = self.d.sentry['ibm-was-nd-dm'][0]
39
+        state_was_nd_dm = unit.info['agent-state']
40
+        print('WAS ND DM is %s' % state_was_nd_dm)
41
+        url = 'http://%s:9060/ibm/console' % unit.info['public-address']
42
+        https_url = 'https://%s:9043/ibm/console' % unit.info['public-address']
43
+        response = requests.get(url, verify=False)
44
+        response = requests.get(https_url, verify=False)
45
+        # Raise an exception if the url was not a valid web page.
46
+        response.raise_for_status()
47
+
48
+    def test_was_nd_dm_ihs(self):
49
+        http_unit = self.d.sentry['ibm-http'][0]
50
+        state_http = http_unit.info['agent-state']
51
+        print('Http Server is %s' % state_http)
52
+        url = 'http://%s:80' % http_unit.info['public-address']
53
+        snoop_url = 'http://%s:80/snoop' % http_unit.info['public-address']
54
+        response = requests.get(url, verify=False)
55
+        response = requests.get(snoop_url, verify=False)
56
+        response.raise_for_status()
57
+
58
+
59
+if __name__ == '__main__':
60
+    unittest.main()
Back to file index

tests/tests.yaml

1
--- 
2
+++ tests/tests.yaml
3
@@ -0,0 +1,5 @@
4
+packages:
5
+  - amulet
6
+  - python3
7
+  - unzip
8
+  - pwgen
Back to file index

tox.ini

 1
--- 
 2
+++ tox.ini
 3
@@ -0,0 +1,12 @@
 4
+[tox]
 5
+skipsdist=True
 6
+envlist = py34, py35
 7
+skip_missing_interpreters = True
 8
+
 9
+[testenv]
10
+commands = py.test -v
11
+deps =
12
+    -r{toxinidir}/requirements.txt
13
+
14
+[flake8]
15
+exclude=docs