<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to set instance.statusMessage in HPE Morpheus Enterprise</title>
    <link>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251448#M4622</link>
    <description>&lt;P&gt;This works fine for me&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;DIV class="lightbox-wrapper"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://community.hpe.com/t5/image/serverpage/image-id/150536i81B7E268E4C7381A/image-size/large?v=v2&amp;amp;px=2000" role="button" title="c17704480359aa016d652cf68280663088d01759.png" alt="c17704480359aa016d652cf68280663088d01759.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Task settings and script&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;DIV class="lightbox-wrapper"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://community.hpe.com/t5/image/serverpage/image-id/150465i43479F0311B84E5A/image-size/large?v=v2&amp;amp;px=2000" role="button" title="a81421b11bc298f002dcb846362488b0cb3bf7ba.png" alt="a81421b11bc298f002dcb846362488b0cb3bf7ba.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Run as a provisioning workflow, with task run in the config phase.&lt;/P&gt;
&lt;P&gt;Give that a shot.&lt;/P&gt;</description>
    <pubDate>Thu, 20 Feb 2025 13:53:58 GMT</pubDate>
    <dc:creator>Ollie-Phillips</dc:creator>
    <dc:date>2025-02-20T13:53:58Z</dc:date>
    <item>
      <title>How to set instance.statusMessage</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251444#M4618</link>
      <description>&lt;P&gt;Is there a way to add our own instance messageStatus?  I see in the email template for provisioning complete:&lt;/P&gt;
&lt;PRE style="background : #f0f1f2;"&gt;&lt;CODE class="lang-auto"&gt;{{#if instance.statusMessage}}
  &amp;lt;p&amp;gt;{{instance.statusMessage}}&amp;lt;/p&amp;gt;
{{/if}}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If I could run a shell script in the workflow to add our custom provisioning message then the template would not need customized.  I would like to be able to set the value of instance.statusMessage in a provisoning workflow so when completed successfully I could have the default template send an email with the message body including something like, “Please wait 10 minutes for the system reconfiguration to complete”&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 02:45:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251444#M4618</guid>
      <dc:creator />
      <dc:date>2025-02-19T02:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to set instance.statusMessage</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251445#M4619</link>
      <description>&lt;P&gt;That could be the case. If you can, please post up your full script and state in which phase it is running. No promises, but someone may be able to test/validate the script when get a moment.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 09:18:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251445#M4619</guid>
      <dc:creator>Ollie-Phillips</dc:creator>
      <dc:date>2025-02-20T09:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to set instance.statusMessage</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251446#M4620</link>
      <description>&lt;P&gt;I created a Python automation script with the simple code below:&lt;/P&gt;
&lt;PRE style="background : #f0f1f2;"&gt;&lt;CODE class="lang-auto"&gt;morpheus['instance']['statusMessage'] = "The instance will restart in 15 minutes after the puppet configuration has completed"
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And when that is set the workflow is complete but the statusMessage has nothing extra.  I dumped all the python vars and I see instance.server.statusMessage = null.&lt;BR /&gt;
But when i try and set the value in Automation using morpheus.instance.server.statusMessage I get an error in the script.  If i correct and complete the automation step I get a message, but it’s the same error on the Provisioning History (below).  My guess is “statusMessage” for the instance is something only morpheus can touch, so we’ll just extend the email template and look for the OS instance; and if it is RHEL to include our puppet message for the pending satellite configuration steps.&lt;/P&gt;
&lt;H4&gt;&lt;A name="p-6959-error-1" class="anchor" href="#p-6959-error-1"&gt;&lt;/A&gt;Error&lt;/H4&gt;
&lt;P&gt;Traceback (most recent call last): File “”, line 5, in  KeyError: ‘server’&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 01:38:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251446#M4620</guid>
      <dc:creator />
      <dc:date>2025-02-20T01:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to set instance.statusMessage</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251447#M4621</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;It’s possible to alter morpheus vars via script. Typical examples could be changing things like instance name and hostname, and usually during the config phase since this phase allows data to be modified that is passed to the provisioning job&lt;/P&gt;
&lt;P&gt;You could try setting it in that phase, but I’d caveat that. It may be something updated when provisioning is complete or failed. You may need to use provision or post-provision phase, and even then it would depend on whether the email is sent, prior to workflows in those phases being executed&lt;/P&gt;
&lt;P&gt;One to test.&lt;/P&gt;
&lt;P&gt;To help, this script in Python, should give you enough info to create a task &amp;amp; provisioning workflow to test your ability to update that variable prior to the email getting sent.&lt;/P&gt;
&lt;ASIDE class="onebox githubblob" data-onebox-src="https://github.com/gomorpheus/morpheus-automation-examples/blob/main/Python/configurationPhase/updateHostname.py"&gt;
  &lt;HEADER class="source"&gt;

      &lt;A href="https://github.com/gomorpheus/morpheus-automation-examples/blob/main/Python/configurationPhase/updateHostname.py" target="_blank" rel="noopener"&gt;github.com/gomorpheus/morpheus-automation-examples&lt;/A&gt;
  &lt;/HEADER&gt;

  &lt;ARTICLE class="onebox-body"&gt;
    &lt;H4&gt;&lt;A href="https://github.com/gomorpheus/morpheus-automation-examples/blob/main/Python/configurationPhase/updateHostname.py" target="_blank" rel="noopener"&gt;Python/configurationPhase/updateHostname.py&lt;/A&gt;&lt;/H4&gt;

&lt;DIV class="git-blob-info"&gt;
  &lt;A href="https://github.com/gomorpheus/morpheus-automation-examples/blob/main/Python/configurationPhase/updateHostname.py" rel="noopener"&gt;&lt;CODE style="background : #f0f1f2;"&gt;main&lt;/CODE&gt;&lt;/A&gt;
&lt;/DIV&gt;


      &lt;PRE style="background : #f0f1f2;"&gt;&lt;CODE class="lang-py"&gt;#Updates hostname based on the instance name. 
# Strips out the first 4 characters from the instance name and use that as hostname. 
# It also gets the memory size selected by user during provisining, calculates the second disk size to be used as paging disk based on memory
# Calculatin : 1.5 X memory + 1GB

import json, requests, urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
 
configspec = morpheus['spec']
 
osname = configspec['hostName']
newname = osname[4]:
configspec['hostName'] = newname
configspec['computedHostName'] = newname
configspec['instance']['hostName'] = newname
configspec['computedName'] = newname
configspec['customOptions']['hostName'] = newname
# Fetch the plan id. API call to get plan details, parse the memory and decide the value of the second disk
DISK_MEMORY_MAP = {
    "4" : "7",
&lt;/CODE&gt;&lt;/PRE&gt;



  This file has been truncated. &lt;A href="https://github.com/gomorpheus/morpheus-automation-examples/blob/main/Python/configurationPhase/updateHostname.py" target="_blank" rel="noopener"&gt;show original&lt;/A&gt;

  &lt;/ARTICLE&gt;

  &lt;DIV class="onebox-metadata"&gt;
    
    
  &lt;/DIV&gt;

  &lt;DIV style="clear: both"&gt;&lt;/DIV&gt;
&lt;/ASIDE&gt;</description>
      <pubDate>Wed, 19 Feb 2025 09:14:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251447#M4621</guid>
      <dc:creator>Ollie-Phillips</dc:creator>
      <dc:date>2025-02-19T09:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to set instance.statusMessage</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251448#M4622</link>
      <description>&lt;P&gt;This works fine for me&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;DIV class="lightbox-wrapper"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://community.hpe.com/t5/image/serverpage/image-id/150536i81B7E268E4C7381A/image-size/large?v=v2&amp;amp;px=2000" role="button" title="c17704480359aa016d652cf68280663088d01759.png" alt="c17704480359aa016d652cf68280663088d01759.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Task settings and script&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;DIV class="lightbox-wrapper"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://community.hpe.com/t5/image/serverpage/image-id/150465i43479F0311B84E5A/image-size/large?v=v2&amp;amp;px=2000" role="button" title="a81421b11bc298f002dcb846362488b0cb3bf7ba.png" alt="a81421b11bc298f002dcb846362488b0cb3bf7ba.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Run as a provisioning workflow, with task run in the config phase.&lt;/P&gt;
&lt;P&gt;Give that a shot.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 13:53:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251448#M4622</guid>
      <dc:creator>Ollie-Phillips</dc:creator>
      <dc:date>2025-02-20T13:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to set instance.statusMessage</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251449#M4623</link>
      <description>&lt;P&gt;That is amazing.  I did not make the connection with the new spec.  I’m trying it on our environment but I think I’m working through some other issues.  When I put this script in config mode workflow I could not provision new instances.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Feb 2025 15:09:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251449#M4623</guid>
      <dc:creator />
      <dc:date>2025-02-22T15:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to set instance.statusMessage</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251450#M4624</link>
      <description>&lt;P&gt;Thank you for the link and pointer.  I can from the example a good start for connecting back to the Morpheus API with the instance token.  I will need to dig through the documentation to see where the instance endpoint exists and see if I can set that.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 14:33:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251450#M4624</guid>
      <dc:creator />
      <dc:date>2025-02-19T14:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to set instance.statusMessage</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251451#M4625</link>
      <description>&lt;P&gt;Ignore that piece (lines 19 - 40), it’s not needed for what you want to achieve.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 14:48:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise/how-to-set-instance-statusmessage/m-p/7251451#M4625</guid>
      <dc:creator>Ollie-Phillips</dc:creator>
      <dc:date>2025-02-19T14:48:20Z</dc:date>
    </item>
  </channel>
</rss>

