You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ambari.apache.org by Rohit Kale <ro...@persistent.com> on 2016/01/08 13:28:32 UTC

Need help Regarding Ambari Custom service Creation

Hi
I need a help regarding ambari custom service,
I want to add a custom service in ambari which copies a file to multiple ambari agents,
For this I want to provide variables for file path in python scripts, these python scripts get called by the service.
I want to get some variable or a way by which I can use the relative path for copying my file
For e.g. I want to copy a file from location X to Y in python script
X location in contained in some ambari folder let's say "/var/lib/ambari-server/resources/stacks/HDP/2.2/services/<MY SERVICE NAME>/my_sample_file.txt"
Y location some location in same node say "/tmp/"

I want that I can fetch X location by some variable so that I can use to copy like:
Copy  some_variable_name/my_sample_file.txt   /tmp/

Can someone help me in this, I tried using "../../" relative path but it doesn't work.

Regards,
Rohit Kale


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.


RE: Re:Need help Regarding Ambari Custom service Creation

Posted by Rohit Kale <ro...@persistent.com>.
Hi All,
I need help regarding Ambari shell,
How  we can use ambari shell ?
I am using ambari 2.0

Regards,
Rohit Kale
+91-8983524506

From: Sumit Mohanty [mailto:smohanty@hortonworks.com]
Sent: Tuesday, January 12, 2016 7:35 PM
To: user@ambari.apache.org
Subject: Re: Re:Need help Regarding Ambari Custom service Creation


I do not think we have such a function in the resource_management library.



But you can call any shell command using the Execute() function.



-Sumit

________________________________
From: Rohit Kale <ro...@persistent.com>>
Sent: Tuesday, January 12, 2016 2:45 AM
To: user@ambari.apache.org<ma...@ambari.apache.org>
Subject: RE: Re:Need help Regarding Ambari Custom service Creation

Hi Sumit,
Thanks for your valuable answer,
I was having one more query,
Can I use this static function or block to append some string lines from one file to another file,
Like this File() function is used here for copying,
Is there anything we can use for appending from one file to another file.

Regards,
Rohit Kale
+91-8983524506

From: Sumit Mohanty [mailto:smohanty@hortonworks.com]
Sent: Friday, January 08, 2016 8:15 PM
To: user@ambari.apache.org<ma...@ambari.apache.org>
Subject: Re: Re:Need help Regarding Ambari Custom service Creation


The files in folder package/files folders are example of static files that are available to the service scripts to use.



This is one example of such pattern:



File(format("{dest_conf_dir}/{name}"),
  mode=0644,
  group=params.user_group,
  owner=params.accumulo_user,
  content=StaticFile(name)
)



________________________________
From: Rohit Kale <ro...@persistent.com>>
Sent: Friday, January 08, 2016 5:31 AM
To: user@ambari.apache.org<ma...@ambari.apache.org>
Subject: RE: Re:Need help Regarding Ambari Custom service Creation

I have just used a sample path here,
I just want to get some variable through which I can get the location or path where we install services e.g.
"/var/lib/ambari-server/resources/stacks/HDP/2.2/services/<MY SERVICE NAME>"

Regards,
Rohit Kale
+91-8983524506

From: Zhang Ruiqiang [mailto:zh.r.q@163.com]
Sent: Friday, January 08, 2016 6:55 PM
To: user@ambari.apache.org<ma...@ambari.apache.org>
Subject: Re:Need help Regarding Ambari Custom service Creation

  I can't catch your meaning. Where does the source file path come from?


At 2016-01-08 20:28:32, "Rohit Kale" <ro...@persistent.com>> wrote:
Hi
I need a help regarding ambari custom service,
I want to add a custom service in ambari which copies a file to multiple ambari agents,
For this I want to provide variables for file path in python scripts, these python scripts get called by the service.
I want to get some variable or a way by which I can use the relative path for copying my file
For e.g. I want to copy a file from location X to Y in python script
X location in contained in some ambari folder let's say "/var/lib/ambari-server/resources/stacks/HDP/2.2/services/<MY SERVICE NAME>/my_sample_file.txt"
Y location some location in same node say "/tmp/"

I want that I can fetch X location by some variable so that I can use to copy like:
Copy  some_variable_name/my_sample_file.txt   /tmp/

Can someone help me in this, I tried using "../../" relative path but it doesn't work.

Regards,
Rohit Kale


DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.




DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.


Re: Re:Need help Regarding Ambari Custom service Creation

Posted by Sumit Mohanty <sm...@hortonworks.com>.
I do not think we have such a function in the resource_management library.


But you can call any shell command using the Execute() function.


-Sumit

________________________________
From: Rohit Kale <ro...@persistent.com>
Sent: Tuesday, January 12, 2016 2:45 AM
To: user@ambari.apache.org
Subject: RE: Re:Need help Regarding Ambari Custom service Creation

Hi Sumit,
Thanks for your valuable answer,
I was having one more query,
Can I use this static function or block to append some string lines from one file to another file,
Like this File() function is used here for copying,
Is there anything we can use for appending from one file to another file.

Regards,
Rohit Kale
+91-8983524506

From: Sumit Mohanty [mailto:smohanty@hortonworks.com]
Sent: Friday, January 08, 2016 8:15 PM
To: user@ambari.apache.org
Subject: Re: Re:Need help Regarding Ambari Custom service Creation


The files in folder package/files folders are example of static files that are available to the service scripts to use.



This is one example of such pattern:



File(format("{dest_conf_dir}/{name}"),
  mode=0644,
  group=params.user_group,
  owner=params.accumulo_user,
  content=StaticFile(name)
)



________________________________
From: Rohit Kale <ro...@persistent.com>>
Sent: Friday, January 08, 2016 5:31 AM
To: user@ambari.apache.org<ma...@ambari.apache.org>
Subject: RE: Re:Need help Regarding Ambari Custom service Creation

I have just used a sample path here,
I just want to get some variable through which I can get the location or path where we install services e.g.
“/var/lib/ambari-server/resources/stacks/HDP/2.2/services/<MY SERVICE NAME>”

Regards,
Rohit Kale
+91-8983524506

From: Zhang Ruiqiang [mailto:zh.r.q@163.com]
Sent: Friday, January 08, 2016 6:55 PM
To: user@ambari.apache.org<ma...@ambari.apache.org>
Subject: Re:Need help Regarding Ambari Custom service Creation

  I can't catch your meaning. Where does the source file path come from?



At 2016-01-08 20:28:32, "Rohit Kale" <ro...@persistent.com>> wrote:
Hi
I need a help regarding ambari custom service,
I want to add a custom service in ambari which copies a file to multiple ambari agents,
For this I want to provide variables for file path in python scripts, these python scripts get called by the service.
I want to get some variable or a way by which I can use the relative path for copying my file
For e.g. I want to copy a file from location X to Y in python script
X location in contained in some ambari folder let’s say “/var/lib/ambari-server/resources/stacks/HDP/2.2/services/<MY SERVICE NAME>/my_sample_file.txt”
Y location some location in same node say “/tmp/”

I want that I can fetch X location by some variable so that I can use to copy like:
Copy  some_variable_name/my_sample_file.txt   /tmp/

Can someone help me in this, I tried using “../../” relative path but it doesn’t work.

Regards,
Rohit Kale


DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.




DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

RE: Re:Need help Regarding Ambari Custom service Creation

Posted by Rohit Kale <ro...@persistent.com>.
Hi Sumit,
Thanks for your valuable answer,
I was having one more query,
Can I use this static function or block to append some string lines from one file to another file,
Like this File() function is used here for copying,
Is there anything we can use for appending from one file to another file.

Regards,
Rohit Kale
+91-8983524506

From: Sumit Mohanty [mailto:smohanty@hortonworks.com]
Sent: Friday, January 08, 2016 8:15 PM
To: user@ambari.apache.org
Subject: Re: Re:Need help Regarding Ambari Custom service Creation


The files in folder package/files folders are example of static files that are available to the service scripts to use.



This is one example of such pattern:



File(format("{dest_conf_dir}/{name}"),
  mode=0644,
  group=params.user_group,
  owner=params.accumulo_user,
  content=StaticFile(name)
)



________________________________
From: Rohit Kale <ro...@persistent.com>>
Sent: Friday, January 08, 2016 5:31 AM
To: user@ambari.apache.org<ma...@ambari.apache.org>
Subject: RE: Re:Need help Regarding Ambari Custom service Creation

I have just used a sample path here,
I just want to get some variable through which I can get the location or path where we install services e.g.
"/var/lib/ambari-server/resources/stacks/HDP/2.2/services/<MY SERVICE NAME>"

Regards,
Rohit Kale
+91-8983524506

From: Zhang Ruiqiang [mailto:zh.r.q@163.com]
Sent: Friday, January 08, 2016 6:55 PM
To: user@ambari.apache.org<ma...@ambari.apache.org>
Subject: Re:Need help Regarding Ambari Custom service Creation

  I can't catch your meaning. Where does the source file path come from?



At 2016-01-08 20:28:32, "Rohit Kale" <ro...@persistent.com>> wrote:
Hi
I need a help regarding ambari custom service,
I want to add a custom service in ambari which copies a file to multiple ambari agents,
For this I want to provide variables for file path in python scripts, these python scripts get called by the service.
I want to get some variable or a way by which I can use the relative path for copying my file
For e.g. I want to copy a file from location X to Y in python script
X location in contained in some ambari folder let's say "/var/lib/ambari-server/resources/stacks/HDP/2.2/services/<MY SERVICE NAME>/my_sample_file.txt"
Y location some location in same node say "/tmp/"

I want that I can fetch X location by some variable so that I can use to copy like:
Copy  some_variable_name/my_sample_file.txt   /tmp/

Can someone help me in this, I tried using "../../" relative path but it doesn't work.

Regards,
Rohit Kale


DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.




DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.


Re: Re:Need help Regarding Ambari Custom service Creation

Posted by Sumit Mohanty <sm...@hortonworks.com>.
The files in folder package/files folders are example of static files that are available to the service scripts to use.


This is one example of such pattern:


File(format("{dest_conf_dir}/{name}"),
  mode=0644,
  group=params.user_group,
  owner=params.accumulo_user,
  content=StaticFile(name)
)


________________________________
From: Rohit Kale <ro...@persistent.com>
Sent: Friday, January 08, 2016 5:31 AM
To: user@ambari.apache.org
Subject: RE: Re:Need help Regarding Ambari Custom service Creation

I have just used a sample path here,
I just want to get some variable through which I can get the location or path where we install services e.g.
"/var/lib/ambari-server/resources/stacks/HDP/2.2/services/<MY SERVICE NAME>"

Regards,
Rohit Kale
+91-8983524506

From: Zhang Ruiqiang [mailto:zh.r.q@163.com]
Sent: Friday, January 08, 2016 6:55 PM
To: user@ambari.apache.org
Subject: Re:Need help Regarding Ambari Custom service Creation

  I can't catch your meaning. Where does the source file path come from?




At 2016-01-08 20:28:32, "Rohit Kale" <ro...@persistent.com>> wrote:

Hi
I need a help regarding ambari custom service,
I want to add a custom service in ambari which copies a file to multiple ambari agents,
For this I want to provide variables for file path in python scripts, these python scripts get called by the service.
I want to get some variable or a way by which I can use the relative path for copying my file
For e.g. I want to copy a file from location X to Y in python script
X location in contained in some ambari folder let's say "/var/lib/ambari-server/resources/stacks/HDP/2.2/services/<MY SERVICE NAME>/my_sample_file.txt"
Y location some location in same node say "/tmp/"

I want that I can fetch X location by some variable so that I can use to copy like:
Copy  some_variable_name/my_sample_file.txt   /tmp/

Can someone help me in this, I tried using "../../" relative path but it doesn't work.

Regards,
Rohit Kale


DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.




DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

RE: Re:Need help Regarding Ambari Custom service Creation

Posted by Rohit Kale <ro...@persistent.com>.
I have just used a sample path here,
I just want to get some variable through which I can get the location or path where we install services e.g.
"/var/lib/ambari-server/resources/stacks/HDP/2.2/services/<MY SERVICE NAME>"

Regards,
Rohit Kale
+91-8983524506

From: Zhang Ruiqiang [mailto:zh.r.q@163.com]
Sent: Friday, January 08, 2016 6:55 PM
To: user@ambari.apache.org
Subject: Re:Need help Regarding Ambari Custom service Creation

  I can't catch your meaning. Where does the source file path come from?




At 2016-01-08 20:28:32, "Rohit Kale" <ro...@persistent.com>> wrote:

Hi
I need a help regarding ambari custom service,
I want to add a custom service in ambari which copies a file to multiple ambari agents,
For this I want to provide variables for file path in python scripts, these python scripts get called by the service.
I want to get some variable or a way by which I can use the relative path for copying my file
For e.g. I want to copy a file from location X to Y in python script
X location in contained in some ambari folder let's say "/var/lib/ambari-server/resources/stacks/HDP/2.2/services/<MY SERVICE NAME>/my_sample_file.txt"
Y location some location in same node say "/tmp/"

I want that I can fetch X location by some variable so that I can use to copy like:
Copy  some_variable_name/my_sample_file.txt   /tmp/

Can someone help me in this, I tried using "../../" relative path but it doesn't work.

Regards,
Rohit Kale


DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.




DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.


Re:Need help Regarding Ambari Custom service Creation

Posted by Zhang Ruiqiang <zh...@163.com>.
  I can't catch your meaning. Where does the source file path come from?






At 2016-01-08 20:28:32, "Rohit Kale" <ro...@persistent.com> wrote:


Hi

I need a help regarding ambari custom service,

I want to add a custom service in ambari which copies a file to multiple ambari agents,

For this I want to provide variables for file path in python scripts, these python scripts get called by the service.

I want to get some variable or a way by which I can use the relative path for copying my file

For e.g. I want to copy a file from location X to Y in python script

X location in contained in some ambari folder let’s say “/var/lib/ambari-server/resources/stacks/HDP/2.2/services/<MY SERVICE NAME>/my_sample_file.txt”

Y location some location in same node say “/tmp/”

 

I want that I can fetch X location by some variable so that I can use to copy like:

Copy  some_variable_name/my_sample_file.txt   /tmp/

 

Can someone help me in this, I tried using “../../” relative path but it doesn’t work.

 

Regards,

Rohit Kale

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.