SlideShare une entreprise Scribd logo
1  sur  46
Practical implementation of promise theory in CFEngine Mikhail Gusarov CFEngine AS <mikhail.gusarov@cfengine.com>
Contents ,[object Object]
&quot;reports&quot;
&quot;processes&quot;
&quot;packages&quot;
&quot;variables&quot;
Summary
Promise theory «Agent A promises to agent B to fulfill C»
Software Implementation ,[object Object]
Real-world example: e-mail ,[object Object],[object Object],[object Object],[object Object]
Multiple MXes
Mail queues ,[object Object],[object Object]
Local routing decisions
Reports body common control { bundlesequence => {&quot;mybundle&quot;}; } bundle agent mybundle { reports: linux:: &quot;Hello world!&quot;; }
Reports body common control { bundlesequence => {&quot;mybundle&quot;}; } bundle agent mybundle { reports: linux:: &quot;Hello world!&quot;; }
Reports bundle agent mybundle { reports: linux:: &quot;Hello world!&quot;; }
Reports bundle agent mybundle { reports: linux:: &quot;Hello world!&quot;; }
Reports bundle agent mybundle { reports: linux:: &quot;Hello world!&quot;; }
Reports bundle agent mybundle { reports: linux:: &quot;Hello world!&quot;; }
Reports (translated) def  mybundle() { if  &quot;linux&quot;  in global_contexts { report(&quot;Hello world!&quot;); } } mybundle()
Reports (run) $  cf-agent R: Hello world! $
Reports (run) $  cf-agent R: Hello world! $  cf-agent $
Reports (run) $  cf-agent R: Hello world! $  cf-agent $  cf-agent $
Reports bundle agent mybundle { reports: linux:: &quot;Hello world!&quot;; &quot;That's surprising&quot;; }
Reports (run) $  cf-agent R: Hello world! $  cf-agent $  cf-agent $  cf-agent R: That's surprising $
Reports (run) $  cf-agent R: Hello world! $  cf-agent $  cf-agent $  cf-agent R: That's surprising $  cf-agent R: Hello world! $
def  mybundle() { promises.add( report(&quot;Hello world!&quot;, activate =  λ :  &quot;linux&quot; in global_contexts)) } mybundle() run_all_relevant_promises()
«Ensure that specified message is reported to sysadmin as soon as possible, but no more than once per 5 minutes to the sysadmin using the specified reporting mechanisms»
«Ensure that specified message is  reported  to sysadmin as soon as possible, but no  more than once per 5 minutes  to the sysadmin using the specified reporting mechanisms» Convergence
«Ensure that specified message is reported to sysadmin  as soon as possible , but no more than once per 5 minutes to the sysadmin using the specified reporting mechanisms» Embracing errors
«Ensure that specified message is reported to sysadmin as soon as possible, but no more than once per 5 minutes to the sysadmin  using the specified reporting mechanisms » Autonomy
Processes bundle agent myprocesses { processes: &quot;nginx&quot; match_range => irange(&quot;1&quot;,&quot;20&quot;); restart_class => &quot;restart_nginx&quot;; commands: restart_nginx:: &quot;/etc/init.d/nginx start&quot;; }
Processes bundle agent myprocesses { processes: &quot;nginx&quot; match_range => irange( &quot;1&quot;,&quot;20&quot; ); restart_class => &quot;restart_nginx&quot;; commands: restart_nginx:: &quot;/etc/init.d/nginx start&quot;; }
Processes bundle agent myprocesses { processes: &quot;nginx&quot; match_range => irange( &quot;1&quot;,&quot;inf&quot; ); restart_class =>  &quot;restart_nginx&quot; ; commands: restart_nginx:: &quot;/etc/init.d/nginx start&quot;; }
def  myprocesses() { nginx_cnt = count_proc(&quot;nginx&quot;) if  nginx_cnt  == 0 { promises.add( command( &quot;/etc/init.d/nginx start&quot;)) }  elif  nginx_cnt  > 20  { Promises.add(kill(&quot;nginx&quot;, nginx_cnt – 20)) } } myprocesses() run_all_relevant_promises()
def  myprocesses() { promises.add( processes(&quot;nginx&quot;, λ  count:  if  count == 0 { define_context(&quot;restart_nginx&quot;)}) promises.add( commands( &quot;/etc/init.d/nginx start&quot;, activate_if =  λ : &quot;restart_nginx&quot; in global_contexts)) } myprocesses() run_all_relevant_promises()
«Ensure that amount of specified processes is kept in specified range, killing extra processes and communicating the need to restart if necessary»
«Ensure that amount of specified processes is kept  in specified range ,  killing extra processes and communicating the need to restart  if necessary» Convergence
« Ensure that amount of specified processes is kept in specified range, killing extra processes and communicating the need to restart if necessary » Embracing errors
«Ensure that amount of specified processes  is kept  in specified range, killing extra processes and communicating the need to restart if necessary» Autonomy
Packages bundle agent mypackages { packages: &quot;libapache2-mod-wsgi&quot; package_method => apt, package_policy => &quot;addupdate&quot;, package_version => &quot;3.3-4&quot;, package_select => &quot;>=&quot;; }
Packages bundle agent mypackages { packages: &quot; libapache2-mod-wsgi &quot; package_method =>  apt , package_policy => &quot; addupdate &quot;, package_version => &quot; 3.3-4 &quot;, package_select => &quot; >= &quot;; }
Packages (translated) (Implementation is too large to fit in the  margin slide)
«Ensure that specified package is installed or not installed according to the constraints specified. Do this by instructing local package manager to add, upgrade or remove package»
«Ensure that specified package is installed or not installed according to the constraints specified. Do this by instructing local package manager to add, upgrade or remove package» Convergent
«Ensure that specified package is installed or not installed according to the constraints specified. Do this by instructing local package manager to add, upgrade or remove package» Embracing errors

Contenu connexe

Tendances

Perl: Hate it for the Right Reasons
Perl: Hate it for the Right ReasonsPerl: Hate it for the Right Reasons
Perl: Hate it for the Right ReasonsMatt Follett
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principlesPerl Careers
 
Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012Toru Furukawa
 
Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7Masahiro Nagano
 
Faster PHP apps using Queues and Workers
Faster PHP apps using Queues and WorkersFaster PHP apps using Queues and Workers
Faster PHP apps using Queues and WorkersRichard Baker
 
DJUGL - Django and AWS Lambda
DJUGL - Django and AWS LambdaDJUGL - Django and AWS Lambda
DJUGL - Django and AWS LambdaMalcolm Box
 
Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.Workhorse Computing
 
Selenium Sandwich Part 1: Data driven Selenium
Selenium Sandwich Part 1: Data driven Selenium Selenium Sandwich Part 1: Data driven Selenium
Selenium Sandwich Part 1: Data driven Selenium Workhorse Computing
 
A reviravolta do desenvolvimento web
A reviravolta do desenvolvimento webA reviravolta do desenvolvimento web
A reviravolta do desenvolvimento webWallace Reis
 
Build a bot workshop async primer - php[tek]
Build a bot workshop  async primer - php[tek]Build a bot workshop  async primer - php[tek]
Build a bot workshop async primer - php[tek]Adam Englander
 
Head in the Clouds: Testing Infra as Code - Config Management 2020
Head in the Clouds: Testing Infra as Code - Config Management 2020Head in the Clouds: Testing Infra as Code - Config Management 2020
Head in the Clouds: Testing Infra as Code - Config Management 2020Peter Souter
 
Be Mean to Your Code - DevOps Days Austin 2013
Be Mean to Your Code - DevOps Days Austin 2013Be Mean to Your Code - DevOps Days Austin 2013
Be Mean to Your Code - DevOps Days Austin 2013James Wickett
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShellDale Lane
 
Capistrano 2 Rocks My World
Capistrano 2 Rocks My WorldCapistrano 2 Rocks My World
Capistrano 2 Rocks My WorldGraeme Mathieson
 
Inspec one tool to rule them all
Inspec one tool to rule them allInspec one tool to rule them all
Inspec one tool to rule them allKimball Johnson
 
Task Scheduling and Asynchronous Processing Evolved. Zend Server Job Queue
Task Scheduling and Asynchronous Processing Evolved. Zend Server Job QueueTask Scheduling and Asynchronous Processing Evolved. Zend Server Job Queue
Task Scheduling and Asynchronous Processing Evolved. Zend Server Job QueueSam Hennessy
 
Gearman - Job Queue
Gearman - Job QueueGearman - Job Queue
Gearman - Job QueueDiego Lewin
 

Tendances (20)

Perl: Hate it for the Right Reasons
Perl: Hate it for the Right ReasonsPerl: Hate it for the Right Reasons
Perl: Hate it for the Right Reasons
 
Lies, Damn Lies, and Benchmarks
Lies, Damn Lies, and BenchmarksLies, Damn Lies, and Benchmarks
Lies, Damn Lies, and Benchmarks
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principles
 
Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012
 
Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7
 
Faster PHP apps using Queues and Workers
Faster PHP apps using Queues and WorkersFaster PHP apps using Queues and Workers
Faster PHP apps using Queues and Workers
 
DJUGL - Django and AWS Lambda
DJUGL - Django and AWS LambdaDJUGL - Django and AWS Lambda
DJUGL - Django and AWS Lambda
 
Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.
 
Selenium sandwich-2
Selenium sandwich-2Selenium sandwich-2
Selenium sandwich-2
 
Selenium Sandwich Part 1: Data driven Selenium
Selenium Sandwich Part 1: Data driven Selenium Selenium Sandwich Part 1: Data driven Selenium
Selenium Sandwich Part 1: Data driven Selenium
 
appache_1
appache_1appache_1
appache_1
 
A reviravolta do desenvolvimento web
A reviravolta do desenvolvimento webA reviravolta do desenvolvimento web
A reviravolta do desenvolvimento web
 
Build a bot workshop async primer - php[tek]
Build a bot workshop  async primer - php[tek]Build a bot workshop  async primer - php[tek]
Build a bot workshop async primer - php[tek]
 
Head in the Clouds: Testing Infra as Code - Config Management 2020
Head in the Clouds: Testing Infra as Code - Config Management 2020Head in the Clouds: Testing Infra as Code - Config Management 2020
Head in the Clouds: Testing Infra as Code - Config Management 2020
 
Be Mean to Your Code - DevOps Days Austin 2013
Be Mean to Your Code - DevOps Days Austin 2013Be Mean to Your Code - DevOps Days Austin 2013
Be Mean to Your Code - DevOps Days Austin 2013
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShell
 
Capistrano 2 Rocks My World
Capistrano 2 Rocks My WorldCapistrano 2 Rocks My World
Capistrano 2 Rocks My World
 
Inspec one tool to rule them all
Inspec one tool to rule them allInspec one tool to rule them all
Inspec one tool to rule them all
 
Task Scheduling and Asynchronous Processing Evolved. Zend Server Job Queue
Task Scheduling and Asynchronous Processing Evolved. Zend Server Job QueueTask Scheduling and Asynchronous Processing Evolved. Zend Server Job Queue
Task Scheduling and Asynchronous Processing Evolved. Zend Server Job Queue
 
Gearman - Job Queue
Gearman - Job QueueGearman - Job Queue
Gearman - Job Queue
 

Similaire à FOSDEM 2012: Practical implementation of promise theory in CFEngine

Exploiting the newer perl to improve your plugins
Exploiting the newer perl to improve your pluginsExploiting the newer perl to improve your plugins
Exploiting the newer perl to improve your pluginsMarian Marinov
 
AMS Node Meetup December presentation Phusion Passenger
AMS Node Meetup December presentation Phusion PassengerAMS Node Meetup December presentation Phusion Passenger
AMS Node Meetup December presentation Phusion Passengericemobile
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
Salt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsSalt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsBenjamin Cane
 
Ten Battle-Tested Tips for Atlassian Connect Add-ons
Ten Battle-Tested Tips for Atlassian Connect Add-onsTen Battle-Tested Tips for Atlassian Connect Add-ons
Ten Battle-Tested Tips for Atlassian Connect Add-onsAtlassian
 
MT_01_unittest_python.pdf
MT_01_unittest_python.pdfMT_01_unittest_python.pdf
MT_01_unittest_python.pdfHans Jones
 
Yapc::Asia 2008 Tokyo - Easy system administration programming with a framewo...
Yapc::Asia 2008 Tokyo - Easy system administration programming with a framewo...Yapc::Asia 2008 Tokyo - Easy system administration programming with a framewo...
Yapc::Asia 2008 Tokyo - Easy system administration programming with a framewo...Gosuke Miyashita
 
Load Testing with PHP and RedLine13
Load Testing with PHP and RedLine13Load Testing with PHP and RedLine13
Load Testing with PHP and RedLine13Jason Lotito
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltStack
 
Service Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMixService Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMixBruce Snyder
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesLindsay Holmwood
 
CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklum Ukraine
 
Antons Kranga Building Agile Infrastructures
Antons Kranga   Building Agile InfrastructuresAntons Kranga   Building Agile Infrastructures
Antons Kranga Building Agile InfrastructuresAntons Kranga
 
Powershell Tech Ed2009
Powershell Tech Ed2009Powershell Tech Ed2009
Powershell Tech Ed2009rsnarayanan
 
AWS Lambda from the trenches
AWS Lambda from the trenchesAWS Lambda from the trenches
AWS Lambda from the trenchesYan Cui
 
Xenogenetics for PL/SQL - infusing with Java best practices
Xenogenetics for PL/SQL - infusing with Java best practicesXenogenetics for PL/SQL - infusing with Java best practices
Xenogenetics for PL/SQL - infusing with Java best practicesLucas Jellema
 

Similaire à FOSDEM 2012: Practical implementation of promise theory in CFEngine (20)

Exploiting the newer perl to improve your plugins
Exploiting the newer perl to improve your pluginsExploiting the newer perl to improve your plugins
Exploiting the newer perl to improve your plugins
 
Revoke-Obfuscation
Revoke-ObfuscationRevoke-Obfuscation
Revoke-Obfuscation
 
AMS Node Meetup December presentation Phusion Passenger
AMS Node Meetup December presentation Phusion PassengerAMS Node Meetup December presentation Phusion Passenger
AMS Node Meetup December presentation Phusion Passenger
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Php
PhpPhp
Php
 
Salt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsSalt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environments
 
Ten Battle-Tested Tips for Atlassian Connect Add-ons
Ten Battle-Tested Tips for Atlassian Connect Add-onsTen Battle-Tested Tips for Atlassian Connect Add-ons
Ten Battle-Tested Tips for Atlassian Connect Add-ons
 
MT_01_unittest_python.pdf
MT_01_unittest_python.pdfMT_01_unittest_python.pdf
MT_01_unittest_python.pdf
 
Yapc::Asia 2008 Tokyo - Easy system administration programming with a framewo...
Yapc::Asia 2008 Tokyo - Easy system administration programming with a framewo...Yapc::Asia 2008 Tokyo - Easy system administration programming with a framewo...
Yapc::Asia 2008 Tokyo - Easy system administration programming with a framewo...
 
Load Testing with PHP and RedLine13
Load Testing with PHP and RedLine13Load Testing with PHP and RedLine13
Load Testing with PHP and RedLine13
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
 
Service Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMixService Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMix
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForce
 
Antons Kranga Building Agile Infrastructures
Antons Kranga   Building Agile InfrastructuresAntons Kranga   Building Agile Infrastructures
Antons Kranga Building Agile Infrastructures
 
Powershell Tech Ed2009
Powershell Tech Ed2009Powershell Tech Ed2009
Powershell Tech Ed2009
 
AWS Lambda from the trenches
AWS Lambda from the trenchesAWS Lambda from the trenches
AWS Lambda from the trenches
 
Xenogenetics
XenogeneticsXenogenetics
Xenogenetics
 
Xenogenetics for PL/SQL - infusing with Java best practices
Xenogenetics for PL/SQL - infusing with Java best practicesXenogenetics for PL/SQL - infusing with Java best practices
Xenogenetics for PL/SQL - infusing with Java best practices
 
Pyramid deployment
Pyramid deploymentPyramid deployment
Pyramid deployment
 

Dernier

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Dernier (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

FOSDEM 2012: Practical implementation of promise theory in CFEngine

  • 1. Practical implementation of promise theory in CFEngine Mikhail Gusarov CFEngine AS <mikhail.gusarov@cfengine.com>
  • 2.
  • 8. Promise theory «Agent A promises to agent B to fulfill C»
  • 9.
  • 10.
  • 12.
  • 14. Reports body common control { bundlesequence => {&quot;mybundle&quot;}; } bundle agent mybundle { reports: linux:: &quot;Hello world!&quot;; }
  • 15. Reports body common control { bundlesequence => {&quot;mybundle&quot;}; } bundle agent mybundle { reports: linux:: &quot;Hello world!&quot;; }
  • 16. Reports bundle agent mybundle { reports: linux:: &quot;Hello world!&quot;; }
  • 17. Reports bundle agent mybundle { reports: linux:: &quot;Hello world!&quot;; }
  • 18. Reports bundle agent mybundle { reports: linux:: &quot;Hello world!&quot;; }
  • 19. Reports bundle agent mybundle { reports: linux:: &quot;Hello world!&quot;; }
  • 20. Reports (translated) def mybundle() { if &quot;linux&quot; in global_contexts { report(&quot;Hello world!&quot;); } } mybundle()
  • 21. Reports (run) $ cf-agent R: Hello world! $
  • 22. Reports (run) $ cf-agent R: Hello world! $ cf-agent $
  • 23. Reports (run) $ cf-agent R: Hello world! $ cf-agent $ cf-agent $
  • 24. Reports bundle agent mybundle { reports: linux:: &quot;Hello world!&quot;; &quot;That's surprising&quot;; }
  • 25. Reports (run) $ cf-agent R: Hello world! $ cf-agent $ cf-agent $ cf-agent R: That's surprising $
  • 26. Reports (run) $ cf-agent R: Hello world! $ cf-agent $ cf-agent $ cf-agent R: That's surprising $ cf-agent R: Hello world! $
  • 27. def mybundle() { promises.add( report(&quot;Hello world!&quot;, activate = λ : &quot;linux&quot; in global_contexts)) } mybundle() run_all_relevant_promises()
  • 28. «Ensure that specified message is reported to sysadmin as soon as possible, but no more than once per 5 minutes to the sysadmin using the specified reporting mechanisms»
  • 29. «Ensure that specified message is reported to sysadmin as soon as possible, but no more than once per 5 minutes to the sysadmin using the specified reporting mechanisms» Convergence
  • 30. «Ensure that specified message is reported to sysadmin as soon as possible , but no more than once per 5 minutes to the sysadmin using the specified reporting mechanisms» Embracing errors
  • 31. «Ensure that specified message is reported to sysadmin as soon as possible, but no more than once per 5 minutes to the sysadmin using the specified reporting mechanisms » Autonomy
  • 32. Processes bundle agent myprocesses { processes: &quot;nginx&quot; match_range => irange(&quot;1&quot;,&quot;20&quot;); restart_class => &quot;restart_nginx&quot;; commands: restart_nginx:: &quot;/etc/init.d/nginx start&quot;; }
  • 33. Processes bundle agent myprocesses { processes: &quot;nginx&quot; match_range => irange( &quot;1&quot;,&quot;20&quot; ); restart_class => &quot;restart_nginx&quot;; commands: restart_nginx:: &quot;/etc/init.d/nginx start&quot;; }
  • 34. Processes bundle agent myprocesses { processes: &quot;nginx&quot; match_range => irange( &quot;1&quot;,&quot;inf&quot; ); restart_class => &quot;restart_nginx&quot; ; commands: restart_nginx:: &quot;/etc/init.d/nginx start&quot;; }
  • 35. def myprocesses() { nginx_cnt = count_proc(&quot;nginx&quot;) if nginx_cnt == 0 { promises.add( command( &quot;/etc/init.d/nginx start&quot;)) } elif nginx_cnt > 20 { Promises.add(kill(&quot;nginx&quot;, nginx_cnt – 20)) } } myprocesses() run_all_relevant_promises()
  • 36. def myprocesses() { promises.add( processes(&quot;nginx&quot;, λ count: if count == 0 { define_context(&quot;restart_nginx&quot;)}) promises.add( commands( &quot;/etc/init.d/nginx start&quot;, activate_if = λ : &quot;restart_nginx&quot; in global_contexts)) } myprocesses() run_all_relevant_promises()
  • 37. «Ensure that amount of specified processes is kept in specified range, killing extra processes and communicating the need to restart if necessary»
  • 38. «Ensure that amount of specified processes is kept in specified range , killing extra processes and communicating the need to restart if necessary» Convergence
  • 39. « Ensure that amount of specified processes is kept in specified range, killing extra processes and communicating the need to restart if necessary » Embracing errors
  • 40. «Ensure that amount of specified processes is kept in specified range, killing extra processes and communicating the need to restart if necessary» Autonomy
  • 41. Packages bundle agent mypackages { packages: &quot;libapache2-mod-wsgi&quot; package_method => apt, package_policy => &quot;addupdate&quot;, package_version => &quot;3.3-4&quot;, package_select => &quot;>=&quot;; }
  • 42. Packages bundle agent mypackages { packages: &quot; libapache2-mod-wsgi &quot; package_method => apt , package_policy => &quot; addupdate &quot;, package_version => &quot; 3.3-4 &quot;, package_select => &quot; >= &quot;; }
  • 43. Packages (translated) (Implementation is too large to fit in the margin slide)
  • 44. «Ensure that specified package is installed or not installed according to the constraints specified. Do this by instructing local package manager to add, upgrade or remove package»
  • 45. «Ensure that specified package is installed or not installed according to the constraints specified. Do this by instructing local package manager to add, upgrade or remove package» Convergent
  • 46. «Ensure that specified package is installed or not installed according to the constraints specified. Do this by instructing local package manager to add, upgrade or remove package» Embracing errors
  • 47. «Ensure that specified package is installed or not installed according to the constraints specified. Do this by instructing local package manager to add, upgrade or remove package» Autonomous
  • 48.
  • 49. «Maintain in-agent binding of left-side name to the value of right-side expression»
  • 50. Convergent, autonomous «Maintain in-agent binding of left-side name to the value of right-side expression»
  • 51. Embracing errors bundle agent myvars { vars: &quot;myvar&quot; string => execresult ( &quot;/usr/bin/testparm /etc/smb/smb.conf&quot;, &quot;noshell&quot;); }
  • 52.
  • 56. Not the things from conventional languages
  • 57. IRC: #cfengine @ FreeNode Web: http://cfengine.com/tech ML: https://cfengine.org/mailman/listinfo Questions?
  • 58.
  • 59.

Notes de l'éditeur

  1. Welcome and thank you for coming. My name is Mikhail Gusarov and I work for CFEngine AS, which is a company backing free software project CFEngine. I expect it to be most interesting to system administrators and software engineers who tried CFEngine and were puzzled by the semantics of operations, and also who read the works on promise theory by Mark Burgess and are trying to figure out how do the theoretical foundation are mapped to real-world CFEngine implementation.
  2. We will start with the quick recap of promise theory, and then proceed to dissect several promise types in CFEngine, trying to find how the fundamental principles are reflected in particular design.
  3. Let&apos;s start with a quick question: please raise your hand if you have used CFEngine before. And who has read the Mark Burgess&apos; papers on promise theory? The promise theory states that in distributed (or multi-agent) systems you may not adequately describe reality by obliging actors to do something, and instead promise is the building block. Promise in computing is similar to the one in real life: it might be broken (voluntarily or forcedly), it might be fulfilled from time to time, so at the best we may only statistically say that the promise is kept.
  4. What does it mean from the software point of view? We need some way do describe and test promises, and the most useful way to do it is to formulate promises in the form of «desired state», with operators to test whether desired state is achieved, and to perform actions on the system to move closer to the desired state. We need to embrace errors, as it&apos;s quite rare situtaion when the promise we are trying to fulfill may be achived by the agent itself, so we need to be able to handle unfulfilled promises by any other agents we communicate with, as well as any internal inconsistencies. We need to be able to work autonomously, as we may not rely to another agents. At least we should be able to fail gracefully and wait until other agents start to fulfill their promises.
  5. Here&apos;s an example of a reliable system which uses all of those principles. E-mail «promises» are convergent, in the sense that single promise this system fulfills is to deliver mail to the given address, and every MTA knows how to verify whether this promise is fulfilled or not, and how to advance in achievement of this promise. E-mail embraces errors, and there is huge lot of error handling in all components of-email. E-mail is autonomous in the sense, that any MTA is able to work offline, and does not fail completely if there is no DNS service. Once external services is available, it fetches the necessary data, makes routing decision and contines with delivery.
  6. Let&apos;s start with a simple policy.
  7. First section declares what _bundles_ are to be taken into account during CFEngine run, and is not particularily interesting. I will skip this part of the policy for the rest of the talk.
  8. Let&apos;s have a look at second one. This is a bundle, that is, a building block for CFEngine policy, best approximated as a module in other languages.
  9. This module contains a single statement of type &amp;quot;report&amp;quot;.
  10. executed only in context &amp;quot;linux&amp;quot;, which is the case on Linux machines.
  11. This statement asks to report a string &amp;quot;Hello world!&amp;quot;.
  12. Let&apos;s use some imaginary imperative programming language to re-state the policy above. From the look of it, it looks similar to ... But does it behave this way?
  13. Let&apos;s run it. Fine nothing unexpected.
  14. Let&apos;s run it again. That&apos;s interesting.
  15. Let&apos;s run it again. Hmm...
  16. Let&apos;s add another report statement.
  17. And run it again.
  18. And one more time. So, the «reports» statement does not behave like a conventional «print» statement from imperative language.
  19. More correct restatement in imaginary language we have used before would be like the following.
  20. If we would specify the «reports» promise from CFEngine language in English, it would sound similar to the following.
  21. This type of promises is convergent: we know the end state, and how to get closer to it.
  22. This type of promises embraces errors, as we know that reporting mechanisms are not always available.
  23. And this this type of promise is autonomous in the sense that agent does not need any additional information to decide where to direct the report.
  24. Let&apos;s have a look at another promise.
  25. This declaration promises that agent will keep number of «nginx» processes in specified range.
  26. And if it is not, extra processes will be killed, or the need to spawn new processes will be communicated to another promise.
  27. This is a simplistic rewrite of the previous policy in our imaginary imperative language, but it is not accurate in one significant aspect: this code only checks for amount of nginx processes once, while agent is able to re-check it again, if other parts of policy do a corrections, and spawn or kill monitored processes.
  28. So the following rewrite would be more adequate, but as you easily see, it is just a restatement of policy in different syntax.
  29. Let&apos;s try to formulate what does this promise type say.
  30. This promise type is convergent, as we know the target state, and how to reach it.
  31. The mere existance of this promise type is admittance of the fact processes may run out of the control.
  32. And the promise type is obviously autonomous, as it does not need any external data to proceed.
  33. Let&apos;s consider the next promise:
  34. Agent promises to ensure that package libapache2-mod-wsgi from APT repository is installed and has version at least 3.3-4.
  35. I won&apos;t even try to translate this kind of promise, as it will be either very verbose, or just restate the policy language using DSL of some sort.
  36. The following description of package promise type is simplified (as it does not include large number of less-used features, like lack of local package manager, or rarely used operations), but nonetheless useful.
  37. Packages promise is obviously convergent, as we know the end state and how to reach it.
  38. It implicitly embraces errors, as implementation will patiently wait until local package manager is able to do what is requested (e.g. until network is available to fetch new packages)
  39. And the promise is autonomous in the sense that no extra information is needed to verify the state or to try to reach the promised state.
  40. Variables are special kind of promises. They belong to the agent itself, and not to the environment.
  41. And hence their semantics is pretty similar to the one you might find in functional languages.
  42. Variables are trivially convergent and autonomous by definition.
  43. But still, there is error-handling component. CFEngine variables will try to evaluate itself until it suceeds. For example, in this variable definition, execresult function may fail if testparm binary is not available, and variable will be evaluated as frequently as deemed necessary to try to get it value, e.g. If testparm binary is installed by another part of policy.
  44. So, we have got through three constructs in CFEngine language, and all of them shown the same unifying principles behind: convergency, embracing errors, and autonomy. This approach distinguishes CFEngine from configuration management tools, such as glorified parallel shell wrappers, where you need to think of convergence yourself, and the language does not help you to produce self-healing systems. But also this approach makes CFEngine language so different from conventional languages.
  45. As you just saw, the building blocks of CFEngine language are quite different from the functional or imperative languages. CFEngine agent does not execute sequence of commands, and does not evaluate a function changing world as a side-effect, but keeps a number of promises. There are roughly two ways of describing domain knowledge in machine-readable way: * eDSL for general-purpose language * Separate DSL Some promises may require a great deal of context to be bundled in order to be convergent, and do not docempose to more fundamental entities which still have the property of convergency. This makes describing policies as a eDSL pretty cumbersome - resulting eDSL would still have to have all the CFEngine language primitives, including classes and variables, so it would just add another layer of syntactic clutter on top of the same semantics. Considering this issue, CFEngine chose the approach of having a separate DSL.