You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by am...@apache.org on 2018/04/10 09:45:14 UTC

[ambari] branch trunk updated (de12df0 -> 2d125c9)

This is an automated email from the ASF dual-hosted git repository.

amagyar pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git.


    from de12df0  Merge pull request #946 from hiveww/AMBARI-23522-trunk
     new 15cdec0  AMBARI-23336 Editing configurations usings configs.py doesnt have options to pass service config version note
     new 081dc84  AMBARI-23336 Editing configurations using configs.py doesn't have options to pass service config version note - review comments (asnaik)
     new 2d125c9  Tweak whitespace

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/resources/scripts/configs.py          | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
amagyar@apache.org.

[ambari] 01/03: AMBARI-23336 Editing configurations usings configs.py doesnt have options to pass service config version note

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

amagyar pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit 15cdec0a2b5be1d28a02de819ddd421f5a5d3653
Author: Akhil Subhash Naik <as...@hortonworks.com>
AuthorDate: Fri Mar 23 15:16:25 2018 +0530

    AMBARI-23336 Editing configurations usings configs.py doesnt have options to pass service config version note
---
 .../src/main/resources/scripts/configs.py          | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/ambari-server/src/main/resources/scripts/configs.py b/ambari-server/src/main/resources/scripts/configs.py
index fd0004b..487bed5 100644
--- a/ambari-server/src/main/resources/scripts/configs.py
+++ b/ambari-server/src/main/resources/scripts/configs.py
@@ -47,6 +47,7 @@ PROPERTIES = 'properties'
 ATTRIBUTES = 'properties_attributes'
 CLUSTERS = 'Clusters'
 DESIRED_CONFIGS = 'desired_configs'
+SERVICE_CONFIG_NOTE='service_config_version_note'
 TYPE = 'type'
 TAG = 'tag'
 ITEMS = 'items'
@@ -99,13 +100,14 @@ def get_config_tag(cluster, config_type, accessor):
     raise Exception('"{0}" not found in server response. Response:\n{1}'.format(config_type, response))
   return current_config_tag
 
-def create_new_desired_config(cluster, config_type, properties, attributes, accessor):
+def create_new_desired_config(cluster, config_type, properties, attributes, accessor,version_note):
   new_tag = TAG_PREFIX + str(int(time.time() * 1000000))
   new_config = {
     CLUSTERS: {
       DESIRED_CONFIGS: {
         TYPE: config_type,
         TAG: new_tag,
+        SERVICE_CONFIG_NOTE:version_note,
         PROPERTIES: properties
       }
     }
@@ -127,9 +129,9 @@ def get_current_config(cluster, config_type, accessor):
   current_config = config_by_tag[ITEMS][0]
   return current_config[PROPERTIES], current_config.get(ATTRIBUTES, {})
 
-def update_config(cluster, config_type, config_updater, accessor):
+def update_config(cluster, config_type, config_updater, accessor,version_note):
   properties, attributes = config_updater(cluster, config_type, accessor)
-  create_new_desired_config(cluster, config_type, properties, attributes, accessor)
+  create_new_desired_config(cluster, config_type, properties, attributes, accessor,version_note)
 
 def update_specific_property(config_name, config_value):
   def update(cluster, config_type, accessor):
@@ -215,7 +217,7 @@ def get_config(cluster, config_type, accessor, output):
     config[ATTRIBUTES] = attributes
   output(config)
 
-def set_properties(cluster, config_type, args, accessor):
+def set_properties(cluster, config_type, args, accessor,version_note):
   logger.info('### Performing "set":')
 
   if len(args) == 1:
@@ -234,10 +236,10 @@ def set_properties(cluster, config_type, args, accessor):
     config_value = args[1]
     updater = update_specific_property(config_name, config_value)
     logger.info('### new property - "{0}":"{1}"'.format(config_name, config_value))
-  update_config(cluster, config_type, updater, accessor)
+  update_config(cluster, config_type, updater, accessor,version_note)
   return 0
 
-def delete_properties(cluster, config_type, args, accessor):
+def delete_properties(cluster, config_type, args, accessor,version_note):
   logger.info('### Performing "delete":')
   if len(args) == 0:
     logger.error("Not enough arguments. Expected config key.")
@@ -245,7 +247,7 @@ def delete_properties(cluster, config_type, args, accessor):
 
   config_name = args[0]
   logger.info('### on property "{0}"'.format(config_name))
-  update_config(cluster, config_type, delete_specific_property(config_name), accessor)
+  update_config(cluster, config_type, delete_specific_property(config_name), accessor,version_note)
   return 0
 
 
@@ -276,6 +278,7 @@ def main():
   parser.add_option("-l", "--host", dest="host", help="Server external host name")
   parser.add_option("-n", "--cluster", dest="cluster", help="Name given to cluster. Ex: 'c1'")
   parser.add_option("-c", "--config-type", dest="config_type", help="One of the various configuration types in Ambari. Ex: core-site, hdfs-site, mapred-queue-acls, etc.")
+  parser.add_option("-b", "--version-note", dest="version_note",default="", help="Version change notes which will help to know what has been changed in this config , this value is optional and is used for action set ")
 
   config_options_group = OptionGroup(parser, "To specify property(s) please use \"-f\" OR \"-k\" and \"-v'\"")
   config_options_group.add_option("-f", "--file", dest="file", help="File where entire configurations are saved to, or read from. Supported extensions (.xml, .json>)")
@@ -330,6 +333,7 @@ def main():
   host = options.host
   cluster = options.cluster
   config_type = options.config_type
+  version_note = options.version_note
 
   accessor = api_accessor(host, user, password, protocol, port)
   if action == SET_ACTION:
@@ -340,7 +344,7 @@ def main():
       action_args = [options.file]
     else:
       action_args = [options.key, options.value]
-    return set_properties(cluster, config_type, action_args, accessor)
+    return set_properties(cluster, config_type, action_args, accessor,version_note)
 
   elif action == GET_ACTION:
     if options.file:
@@ -354,7 +358,7 @@ def main():
       parser.error("You should use option (-k) to set property name witch will be deleted")
     else:
       action_args = [options.key]
-    return delete_properties(cluster, config_type, action_args, accessor)
+    return delete_properties(cluster, config_type, action_args, accessor,version_note)
   else:
     logger.error('Action "{0}" is not supported. Supported actions: "get", "set", "delete".'.format(action))
     return -1

-- 
To stop receiving notification emails like this one, please contact
amagyar@apache.org.

[ambari] 02/03: AMBARI-23336 Editing configurations using configs.py doesn't have options to pass service config version note - review comments (asnaik)

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

amagyar pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit 081dc848a84d54c52842f7c1f286b7203a749b57
Author: Akhil Subhash Naik <as...@hortonworks.com>
AuthorDate: Mon Mar 26 10:44:29 2018 +0530

    AMBARI-23336 Editing configurations using configs.py doesn't have options to pass service config version note - review comments (asnaik)
---
 ambari-server/src/main/resources/scripts/configs.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ambari-server/src/main/resources/scripts/configs.py b/ambari-server/src/main/resources/scripts/configs.py
index 487bed5..75ced40 100644
--- a/ambari-server/src/main/resources/scripts/configs.py
+++ b/ambari-server/src/main/resources/scripts/configs.py
@@ -278,7 +278,7 @@ def main():
   parser.add_option("-l", "--host", dest="host", help="Server external host name")
   parser.add_option("-n", "--cluster", dest="cluster", help="Name given to cluster. Ex: 'c1'")
   parser.add_option("-c", "--config-type", dest="config_type", help="One of the various configuration types in Ambari. Ex: core-site, hdfs-site, mapred-queue-acls, etc.")
-  parser.add_option("-b", "--version-note", dest="version_note",default="", help="Version change notes which will help to know what has been changed in this config , this value is optional and is used for action set ")
+  parser.add_option("-b", "--version-note", dest="version_note",default="", help="Version change notes which will help to know what has been changed in this config , this value is optional and is used for action <set> and <delete>")
 
   config_options_group = OptionGroup(parser, "To specify property(s) please use \"-f\" OR \"-k\" and \"-v'\"")
   config_options_group.add_option("-f", "--file", dest="file", help="File where entire configurations are saved to, or read from. Supported extensions (.xml, .json>)")

-- 
To stop receiving notification emails like this one, please contact
amagyar@apache.org.

[ambari] 03/03: Tweak whitespace

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

amagyar pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit 2d125c91254b81475cf1b429031b6b66c75808e7
Author: Doroszlai, Attila <64...@users.noreply.github.com>
AuthorDate: Mon Mar 26 10:06:42 2018 +0200

    Tweak whitespace
---
 .../src/main/resources/scripts/configs.py          | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/ambari-server/src/main/resources/scripts/configs.py b/ambari-server/src/main/resources/scripts/configs.py
index 75ced40..12d9156 100644
--- a/ambari-server/src/main/resources/scripts/configs.py
+++ b/ambari-server/src/main/resources/scripts/configs.py
@@ -47,7 +47,7 @@ PROPERTIES = 'properties'
 ATTRIBUTES = 'properties_attributes'
 CLUSTERS = 'Clusters'
 DESIRED_CONFIGS = 'desired_configs'
-SERVICE_CONFIG_NOTE='service_config_version_note'
+SERVICE_CONFIG_NOTE = 'service_config_version_note'
 TYPE = 'type'
 TAG = 'tag'
 ITEMS = 'items'
@@ -100,7 +100,7 @@ def get_config_tag(cluster, config_type, accessor):
     raise Exception('"{0}" not found in server response. Response:\n{1}'.format(config_type, response))
   return current_config_tag
 
-def create_new_desired_config(cluster, config_type, properties, attributes, accessor,version_note):
+def create_new_desired_config(cluster, config_type, properties, attributes, accessor, version_note):
   new_tag = TAG_PREFIX + str(int(time.time() * 1000000))
   new_config = {
     CLUSTERS: {
@@ -129,9 +129,9 @@ def get_current_config(cluster, config_type, accessor):
   current_config = config_by_tag[ITEMS][0]
   return current_config[PROPERTIES], current_config.get(ATTRIBUTES, {})
 
-def update_config(cluster, config_type, config_updater, accessor,version_note):
+def update_config(cluster, config_type, config_updater, accessor, version_note):
   properties, attributes = config_updater(cluster, config_type, accessor)
-  create_new_desired_config(cluster, config_type, properties, attributes, accessor,version_note)
+  create_new_desired_config(cluster, config_type, properties, attributes, accessor, version_note)
 
 def update_specific_property(config_name, config_value):
   def update(cluster, config_type, accessor):
@@ -217,7 +217,7 @@ def get_config(cluster, config_type, accessor, output):
     config[ATTRIBUTES] = attributes
   output(config)
 
-def set_properties(cluster, config_type, args, accessor,version_note):
+def set_properties(cluster, config_type, args, accessor, version_note):
   logger.info('### Performing "set":')
 
   if len(args) == 1:
@@ -236,10 +236,10 @@ def set_properties(cluster, config_type, args, accessor,version_note):
     config_value = args[1]
     updater = update_specific_property(config_name, config_value)
     logger.info('### new property - "{0}":"{1}"'.format(config_name, config_value))
-  update_config(cluster, config_type, updater, accessor,version_note)
+  update_config(cluster, config_type, updater, accessor, version_note)
   return 0
 
-def delete_properties(cluster, config_type, args, accessor,version_note):
+def delete_properties(cluster, config_type, args, accessor, version_note):
   logger.info('### Performing "delete":')
   if len(args) == 0:
     logger.error("Not enough arguments. Expected config key.")
@@ -247,7 +247,7 @@ def delete_properties(cluster, config_type, args, accessor,version_note):
 
   config_name = args[0]
   logger.info('### on property "{0}"'.format(config_name))
-  update_config(cluster, config_type, delete_specific_property(config_name), accessor,version_note)
+  update_config(cluster, config_type, delete_specific_property(config_name), accessor, version_note)
   return 0
 
 
@@ -278,7 +278,7 @@ def main():
   parser.add_option("-l", "--host", dest="host", help="Server external host name")
   parser.add_option("-n", "--cluster", dest="cluster", help="Name given to cluster. Ex: 'c1'")
   parser.add_option("-c", "--config-type", dest="config_type", help="One of the various configuration types in Ambari. Ex: core-site, hdfs-site, mapred-queue-acls, etc.")
-  parser.add_option("-b", "--version-note", dest="version_note",default="", help="Version change notes which will help to know what has been changed in this config , this value is optional and is used for action <set> and <delete>")
+  parser.add_option("-b", "--version-note", dest="version_note", default="", help="Version change notes which will help to know what has been changed in this config. This value is optional and is used for actions <set> and <delete>.")
 
   config_options_group = OptionGroup(parser, "To specify property(s) please use \"-f\" OR \"-k\" and \"-v'\"")
   config_options_group.add_option("-f", "--file", dest="file", help="File where entire configurations are saved to, or read from. Supported extensions (.xml, .json>)")
@@ -344,7 +344,7 @@ def main():
       action_args = [options.file]
     else:
       action_args = [options.key, options.value]
-    return set_properties(cluster, config_type, action_args, accessor,version_note)
+    return set_properties(cluster, config_type, action_args, accessor, version_note)
 
   elif action == GET_ACTION:
     if options.file:
@@ -358,7 +358,7 @@ def main():
       parser.error("You should use option (-k) to set property name witch will be deleted")
     else:
       action_args = [options.key]
-    return delete_properties(cluster, config_type, action_args, accessor,version_note)
+    return delete_properties(cluster, config_type, action_args, accessor, version_note)
   else:
     logger.error('Action "{0}" is not supported. Supported actions: "get", "set", "delete".'.format(action))
     return -1

-- 
To stop receiving notification emails like this one, please contact
amagyar@apache.org.